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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets | arkts | updateYearData | 更新年数据 | updateYearData() {
this.yearViewList = [];
for (let i = 1; i <= Constants.MONTHS_NUM; i++) {
this.yearViewList.push(new OffscreenCanvas(this.year, i));
}
} | AST#method_declaration#Left updateYearData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . yearViewList AST#membe... | updateYearData() {
this.yearViewList = [];
for (let i = 1; i <= Constants.MONTHS_NUM; i++) {
this.yearViewList.push(new OffscreenCanvas(this.year, i));
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets#L35-L40 | 1b932551c01504161fb53d51ef495200ab5b9e50 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 检查是否已关注用户
@param followerId 关注者ID(当前用户)
@param followingId 被关注者ID
@returns 是否已关注 | export function isFollowingUser(followerId: number, followingId: number): Promise<boolean> {
try {
console.info(`检查是否已关注用户, followerId: ${followerId}, followingId: ${followingId}`);
return request<boolean>(RequestMethod.GET, `/users/${followerId}/is-following/${followingId}`);
} catch (error) {
console.... | AST#export_declaration#Left export AST#function_declaration#Left function isFollowingUser AST#parameter_list#Left ( AST#parameter#Left followerId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left followingId : AST#type_annot... | export function isFollowingUser(followerId: number, followingId: number): Promise<boolean> {
try {
console.info(`检查是否已关注用户, followerId: ${followerId}, followingId: ${followingId}`);
return request<boolean>(RequestMethod.GET, `/users/${followerId}/is-following/${followingId}`);
} catch (error) {
console.... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1423-L1431 | 5486060110764d19cf4dfde0b33b96a9dec644e2 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | setData | 将数据写入系统剪贴板,使用Promise异步回调。
@param mimeType 剪贴板数据对应的MIME类型,可以是常量中已定义的类型,包括HTML类型,WANT类型,纯文本类型,URI类型,PIXELMAP类型;也可以是自定义的MIME类型。
@param value 自定义数据内容。
@returns | static async setData(mimeType: string, value: pasteboard.ValueType): Promise<void> {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setData(pasteData);
} | AST#method_declaration#Left static async setData AST#parameter_list#Left ( AST#parameter#Left mimeType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_ty... | static async setData(mimeType: string, value: pasteboard.ValueType): Promise<void> {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setData(pasteData);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L71-L74 | cc5b4ddb658dce30f22fe6be5347f0806ee942e6 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets | arkts | 获取用户全部任务
@param userId 用户ID
@param page 页码(可选)
@param size 每页大小(可选)
@returns 任务列表分页结果 | export function getAllTasks(userId: number, page: number = 0, size: number = 20): Promise<PageResponse<Task>> {
const params: TaskQueryParams = { page, size };
try {
return request<PageResponse<Task>>(
RequestMethod.GET,
`/tasks/user/${userId}/pageable`,
params
);
} catch (error) {
c... | AST#export_declaration#Left export AST#function_declaration#Left function getAllTasks AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AST#... | export function getAllTasks(userId: number, page: number = 0, size: number = 20): Promise<PageResponse<Task>> {
const params: TaskQueryParams = { page, size };
try {
return request<PageResponse<Task>>(
RequestMethod.GET,
`/tasks/user/${userId}/pageable`,
params
);
} catch (error) {
c... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L36-L48 | ccd4b2369ff5de304447ef73ce08250028b82c93 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/entry/src/main/ets/managers/SyncTaskDevelopment.ets | arkts | taskpoolFunc | 步骤1: 定义并发函数,实现业务逻辑 | @Concurrent
async function taskpoolFunc(num: number): Promise<number> {
// 根据业务逻辑实现相应的功能
let tmpNum: number = num + 100;
return tmpNum;
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function taskpoolFunc AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right... | @Concurrent
async function taskpoolFunc(num: number): Promise<number> {
let tmpNum: number = num + 100;
return tmpNum;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/ApplicationMultithreading/entry/src/main/ets/managers/SyncTaskDevelopment.ets#L21-L26 | bf85ba34f5648bb5531022faf9ddf608c7a60f6c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/ListSlideToHistory.ets | arkts | aboutToAppear | 存储防抖计时器 | aboutToAppear(): void {
// 一个函数加载10个,为保证初始页面跳转,因此加载20个列表。
getFriendMomentFromRawfile();
getFriendMomentFromRawfile();
} | AST#method_declaration#Left aboutToAppear 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 { // 一个函数加载10个,为保证初始页面跳转,因此加载20个列表。 AST#ui_custom_component_statement#Left getFriendMomentF... | aboutToAppear(): void {
getFriendMomentFromRawfile();
getFriendMomentFromRawfile();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listslidetohistory/src/main/ets/view/ListSlideToHistory.ets#L77-L81 | 5202053eeeb0c0f2de77245d32eda9029b4dfe88 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 星期枚举 | export enum WeekDay {
SUNDAY = 0,
MONDAY = 1
} | AST#export_declaration#Left export AST#enum_declaration#Left enum WeekDay AST#enum_body#Left { AST#enum_member#Left SUNDAY = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MONDAY = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_de... | export enum WeekDay {
SUNDAY = 0,
MONDAY = 1
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L398-L401 | 24b734c1e567ea84d5e7c60e0f9abf09d460c3a5 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets | arkts | getTaskStatusColor | 获取任务状态颜色
@param status 状态码
@returns 状态颜色 | getTaskStatusColor(status: number): string {
switch (status) {
case 0: return '#888888';
case 1: return '#2196F3';
case 2: return '#4CAF50';
case 3: return '#F44336';
default: return '#888888';
}
} | AST#method_declaration#Left getTaskStatusColor AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | getTaskStatusColor(status: number): string {
switch (status) {
case 0: return '#888888';
case 1: return '#2196F3';
case 2: return '#4CAF50';
case 3: return '#F44336';
default: return '#888888';
}
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskDetailPage.ets#L140-L148 | ed49d43b570a9e1f3b703c95f9748acc6de923ad | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | PerformanceAnalysis/BptaFramePractice/entry/src/main/ets/components/DiscoverView.ets | arkts | [EndExclude discover_view] | build() {
List() {
ForEach(this.dataSource, (item: LearningResource) => {
ListItem() {
ArticleCardView()
.reuseId('article')
}
}, (item: LearningResource) => item.id.toString())
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#e... | build() {
List() {
ForEach(this.dataSource, (item: LearningResource) => {
ListItem() {
ArticleCardView()
.reuseId('article')
}
}, (item: LearningResource) => item.id.toString())
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaFramePractice/entry/src/main/ets/components/DiscoverView.ets#L26-L35 | 16f9308f5369e912d4956d625f6ab6c73d9117f8 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppConstants.ets | arkts | get | 必须是rdb开头的目录
获取应用文档根目录路径(以斜杠结尾)
对应Kotlin的val basePath: String
@returns string 路径字符串,格式如 "/data/app/el2/100/base/com.example/app_Document/" | static get docBasePath(): string {
const context = getAppContext()
// HarmonyOS的目录结构不同,使用filesDir作为基础路径
return `${context.filesDir}/${this.APP_DOCUMENT}/`;
} | AST#method_declaration#Left static get AST#ERROR#Left docB as ePath AST#ERROR#Right 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 co... | static get docBasePath(): string {
const context = getAppContext()
return `${context.filesDir}/${this.APP_DOCUMENT}/`;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppConstants.ets#L25-L29 | c250f4c623a675dd1475c3f021b4404502707fb1 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/TableHelper.ets | arkts | addTableColumnSql | 生成添加新的一列的sql语句 | addTableColumnSql(tableName: string, column: ColumnInfo): string {
let sql = `alter table ${tableName} add `;
sql = sql.concat(`${column.name} ${column.type}`);
sql = sql.concat(`${column.length && column.length > 0 ? `(${column.length})` : ''}`);
return sql;
} | AST#method_declaration#Left addTableColumnSql 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 column : AST#type_annotation#Left AST#primary_type#Left ColumnInfo AST#pr... | addTableColumnSql(tableName: string, column: ColumnInfo): string {
let sql = `alter table ${tableName} add `;
sql = sql.concat(`${column.name} ${column.type}`);
sql = sql.concat(`${column.length && column.length > 0 ? `(${column.length})` : ''}`);
return sql;
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/TableHelper.ets#L22-L27 | 69da5638b2839e3d7988324158a049060f230462 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | cancelAll | 取消所有通知,取消当前应用所有已发布的通知。
@returns | static async cancelAll(): Promise<void> {
return notificationManager.cancelAll()
} | AST#method_declaration#Left static async cancelAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type... | static async cancelAll(): Promise<void> {
return notificationManager.cancelAll()
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L313-L315 | 4fc8333f1bff123d4d60a52cecb00c7e5c529bd8 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/Horspool.ets | arkts | findAllMatches | 在文本中查找模式串的所有出现位置
@param text 文本字符串
@param pattern 模式串
@returns 所有匹配位置的数组 | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const badCharTable = this.buildBadCharTable(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
while (i <... | AST#method_declaration#Left static findAllMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findAllMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const badCharTable = this.buildBadCharTable(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
while (i <... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/Horspool.ets#L12-L41 | 06d89b52385b169fbbf74a1ddb7e7834e0bb7e9d | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/request/CancelOrderRequest.ets | arkts | @file 取消订单请求模型
@author Joker.X | export class CancelOrderRequest {
/**
* 订单ID
*/
orderId: number = 0;
/**
* 取消原因
*/
remark: string = "";
/**
* @param {CancelOrderRequest} init - 初始化数据
*/
constructor(init?: CancelOrderRequest) {
if (init) {
this.orderId = init.orderId;
this.remark = init.remark;
}
}
... | AST#export_declaration#Left export AST#class_declaration#Left class CancelOrderRequest AST#class_body#Left { /**
* 订单ID
*/ AST#property_declaration#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; A... | export class CancelOrderRequest {
orderId: number = 0;
remark: string = "";
constructor(init?: CancelOrderRequest) {
if (init) {
this.orderId = init.orderId;
this.remark = init.remark;
}
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/CancelOrderRequest.ets#L5-L24 | f450961b99dd758421b614fd2f407151abe4d652 | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleNotificationManager.ets | arkts | checkNotificationPermission | 检查通知权限状态 | async checkNotificationPermission(): Promise<boolean> {
try {
hilog.info(0x0000, 'SimpleNotificationManager', 'Notification permission status check (simplified version)');
return true;
} catch (error) {
hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to check notification permission')... | AST#method_declaration#Left async checkNotificationPermission AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Ri... | async checkNotificationPermission(): Promise<boolean> {
try {
hilog.info(0x0000, 'SimpleNotificationManager', 'Notification permission status check (simplified version)');
return true;
} catch (error) {
hilog.error(0x0000, 'SimpleNotificationManager', 'Failed to check notification permission')... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L166-L174 | 966347537fde939c68064a7da15aff2e1e3afdfb | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | @ts-nocheck
Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | export default class ChartAnimator {
/** object that is updated upon animation update */
// private AnimatorUpdateListener mListener;
/** The phase of drawn values on the y-axis. 0 - 1 */
protected mPhaseY: number = 1;
/** The phase of drawn values on the x-axis. 0 - 1 */
protected mPhaseX: number = 1;... | AST#export_declaration#Left export default AST#class_declaration#Left class ChartAnimator AST#class_body#Left { /** object that is updated upon animation update */ // private AnimatorUpdateListener mListener; /** The phase of drawn values on the y-axis. 0 - 1 */ AST#property_declaration#Left protected mPhaseY : AST#... | export default class ChartAnimator {
protected mPhaseY: number = 1;
protected mPhaseX: number = 1;
constructor() {}
private xAnimator(duration: number, easing: EasingFunction): ObjectAnimator {
let animatorX = ObjectAnimator.ofFloat(this, 'phaseX', 0, 1);
animatorX.setInterpolator(easing... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L17-L191 | 2a8724ca4ee2abddf98740a3c84e451bea532676 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/Setting/optionItem.ets | arkts | optionItem | 该组件为设置和其他类似UI的选项布局。
主要内容为图片+文字+导航箭头
powered by yiyefangzhou24
2022/5/15 | @Component
export struct optionItem {
@State bgColor: Resource = $r("app.color.white")
//private img: Resource //图标资源
@State img: string= ''
// private context: string //文字内容
@State context: string='';
@State isNext: boolean = false;
//private marginTop: number //组件上边距
@State marginTop: num... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct optionItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bgColor : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annot... | @Component
export struct optionItem {
@State bgColor: Resource = $r("app.color.white")
@State img: string= ''
@State context: string='';
@State isNext: boolean = false;
@State marginTop: number=1;
private itemOnClick = (event: ClickEvent) =>{}
build(){
Row(){
if(this.img != null){
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/Setting/optionItem.ets#L8-L64 | 843784151fdb27ea8539f84b24cda7e93a092d87 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.AlbumPickerComponent.d.ets | arkts | setFontSize | Set font size to album picker component
@param { number | string } fontSize - font size of album picker component
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 20 | setFontSize(fontSize: number | string): void; | AST#method_declaration#Left setFontSize AST#parameter_list#Left ( AST#parameter#Left fontSize : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#... | setFontSize(fontSize: number | string): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.AlbumPickerComponent.d.ets#L171-L171 | 8de659b466e123b584fbe6d8e92d550f775745e3 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | toast | 自定义的吐司 | toast(index: number) {
if (index == 0) {
//简单使用,长文本
DialogHelper.showToast("女人什么年龄是最好?任何年龄都可以。因为每个年龄段都有不一样的美。看XX的穿搭你就会发现成熟女性的魅力,反而会更加的吸引人。难道这就是传说中的可爱在性感面前真的不值得一提吗?")
} else if (index == 1) {
//自定义的长吐司
DialogHelper.showToastLong("这是一个自定义的长吐司呀~~~", {
fontColor: Color.White,
... | AST#method_declaration#Left toast AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left ... | toast(index: number) {
if (index == 0) {
DialogHelper.showToast("女人什么年龄是最好?任何年龄都可以。因为每个年龄段都有不一样的美。看XX的穿搭你就会发现成熟女性的魅力,反而会更加的吸引人。难道这就是传说中的可爱在性感面前真的不值得一提吗?")
} else if (index == 1) {
DialogHelper.showToastLong("这是一个自定义的长吐司呀~~~", {
fontColor: Color.White,
backgroundColor: "... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L1095-L1122 | 20330e6394c6e57e82eacfde6116bfdcfa1c666c | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/quiz/running/FadeInOutMov.ets | arkts | aboutToAppear | 当前显示图片 | aboutToAppear(): void {
this.onAppearing?.(this)
} | AST#method_declaration#Left aboutToAppear 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#expression... | aboutToAppear(): void {
this.onAppearing?.(this)
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/quiz/running/FadeInOutMov.ets#L19-L21 | a19790ac99196ed354cb29b18d59e1a03b4b6a2c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/viewmodel/GoodsCommentViewModel.ets | arkts | @file 商品评论页面 ViewModel
@author Joker.X | @ObservedV2
export default class GoodsCommentViewModel extends BaseViewModel {
} | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class GoodsCommentViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { } AST#class_body#Rig... | @ObservedV2
export default class GoodsCommentViewModel extends BaseViewModel {
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsCommentViewModel.ets#L7-L9 | 3dbf9e2257888bb2253acda70ea1524fd90a4f59 | github | |
openharmony/base_location | 724370a03f6f23ddc07c8eb9f49dfc61ab716bdb | services/location_ui/entry/src/main/ets/pages/BluetoothShare.ets | arkts | getDeviceType | 获取设备类型
@return string | private static getDeviceType() : string {
return deviceInfo.deviceType;
} | AST#method_declaration#Left private static getDeviceType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#me... | private static getDeviceType() : string {
return deviceInfo.deviceType;
} | https://github.com/openharmony/base_location/blob/724370a03f6f23ddc07c8eb9f49dfc61ab716bdb/services/location_ui/entry/src/main/ets/pages/BluetoothShare.ets#L100-L102 | 50276ef87272753cee2b3b491436f0fc51d128ca | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets | arkts | leftAddressBuilder | 左侧的地址 | @Builder
leftAddressBuilder() {
Text($r('app.string.address_exchange_address_left'))
.width($r('app.string.address_exchange_address_width'))
.textAlign(TextAlign.Center)
.fontSize($r('app.string.address_exchange_font_size'))
.onClick(() => {
promptAction.showToast({
messa... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right leftAddressBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left... | @Builder
leftAddressBuilder() {
Text($r('app.string.address_exchange_address_left'))
.width($r('app.string.address_exchange_address_width'))
.textAlign(TextAlign.Center)
.fontSize($r('app.string.address_exchange_font_size'))
.onClick(() => {
promptAction.showToast({
messa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets#L137-L149 | cda1fc487cc54627aa3704c53a8a127704c954ef | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets | arkts | createOrFinish | 创建或注销AVPlayer | createOrFinish(): void {
if (this.fileUrl == this.selectedVideo) {
this.init();
} else {
this.getStop();
this.release();
}
} | AST#method_declaration#Left createOrFinish AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_ex... | createOrFinish(): void {
if (this.fileUrl == this.selectedVideo) {
this.init();
} else {
this.getStop();
this.release();
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets#L130-L137 | 540e3d920c2713f179c1caabd24bd659d9ab984a | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/ContactService_backup.ets | arkts | updateContact | 更新联系人
@param params 更新参数
@returns 更新后的联系人 | async updateContact(params: UpdateContactParams): Promise<Contact> {
try {
// 验证数据
const validationResult = ContactModel.validate(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
// 获取原有联系人数据
const existingCont... | AST#method_declaration#Left async updateContact AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left UpdateContactParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge... | async updateContact(params: UpdateContactParams): Promise<Contact> {
try {
const validationResult = ContactModel.validate(params);
if (!validationResult.isValid) {
throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`);
}
const existingContact = await this.ge... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService_backup.ets#L158-L207 | 0cdd9eadf0df5bd74cfa7c4eb082169e04053ba9 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets | arkts | NewsDetailPage | 搜索按钮文字
功能描述: 本示例适用于Scroll容器嵌套多组件事件处理场景:当需要一个父容器Scroll内嵌套web、List,当父子的滚动手势冲突时,此时希望父容器的滚动优先级最高,
即实现子组件的偏移量都由父容器统一派发,实现滚动任一子组件流畅滚动到父容器顶/底的效果。
例如本案例的新闻浏览界面,父组件Scroll嵌套了新闻内容与评论区(Web实现新闻内容,List实现评论区),
通过禁用web和list组件滚动手势,再由父组件Scroll统一计算派发偏移量,达到一种web的滚动和list组件滚动能无缝衔接,像同一个滚动组件滚动效果。
推荐场景: 当需要一个父容器Scroll内嵌套web、List,父子的滑动手势冲突时,此... | @Component
export struct NewsDetailPage {
webviewController: webview.WebviewController = new webview.WebviewController(); // 初始化WebviewController
@State changeValue: string = ''; // 搜索框关键词
private listScroller: Scroller = new Scroller(); // 初始化listScroller
@State commentList: NewsCommentData = new NewsCommentDa... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NewsDetailPage AST#component_body#Left { AST#property_declaration#Left webviewController : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AS... | @Component
export struct NewsDetailPage {
webviewController: webview.WebviewController = new webview.WebviewController();
@State changeValue: string = '';
private listScroller: Scroller = new Scroller();
@State commentList: NewsCommentData = new NewsCommentData();
@State curUser: string = curUser;
@S... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L85-L464 | 67244cf7bcb2a0957dd9bd0d1d25c0f929e11182 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextReaderHelper.ets | arkts | playNext | 播放下一篇文章。 | static playNext(): boolean {
try {
TextReader.playNext();
return true;
} catch (e) {
console.error(`TextReader failed to play next article. Code: ${e.code}, message: ${e.message}`);
return false;
}
} | AST#method_declaration#Left static playNext 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#try_statement#Left try AST#block_statement#Left { AST#statement#Lef... | static playNext(): boolean {
try {
TextReader.playNext();
return true;
} catch (e) {
console.error(`TextReader failed to play next article. Code: ${e.code}, message: ${e.message}`);
return false;
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L135-L143 | 545554546664794cac580c63a60184f3afa43b99 | gitee |
Million-mo/tree-sitter-arkts.git | 2fd0ad75e2d848709edcf4be038f27b178114ef6 | examples/custom_builders.ets | arkts | dynamicContentBuilder | 本地Builder方法 - 动态内容Builder | @Builder
dynamicContentBuilder() {
Column() {
if (this.currentTab === 0) {
// 首页内容
this.simpleCardBuilder('欢迎使用', '这是首页的内容区域')
Row() {
Button('主要操作')
.gradientButton(Color.Blue, Color.Purple)
Button('次要操作')
.buttonStyles... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right dynamicContentBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_... | @Builder
dynamicContentBuilder() {
Column() {
if (this.currentTab === 0) {
this.simpleCardBuilder('欢迎使用', '这是首页的内容区域')
Row() {
Button('主要操作')
.gradientButton(Color.Blue, Color.Purple)
Button('次要操作')
.buttonStyles()
... | https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/custom_builders.ets#L163-L226 | 4f72118a94c7444eb2ec02c8279fe29d3019bf5f | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnife.ets | arkts | isFileCacheInit | 判断文件缓存是否已完成初始化
@returns 是否初始化 | public isFileCacheInit(): boolean {
return this.fileCache === undefined ? false : this.fileCache.isFileCacheInit()
} | AST#method_declaration#Left public isFileCacheInit 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_ex... | public isFileCacheInit(): boolean {
return this.fileCache === undefined ? false : this.fileCache.isFileCacheInit()
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L81-L83 | f61a22098d5b1e1b5498c9ec3ff8ef49c4baf8bc | gitee |
huaweicloud/huaweicloud-iot-device-sdk-arkts.git | 72954bea19e7e7f93567487b036c0664457bdaf3 | huaweicloud_iot_device_library/src/main/ets/client/listener/CommandListener.ets | arkts | Copyright 2024 Huawei Cloud IoT Authors 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, softwa... | export interface CommandListener {
/**
* 命令处理
*
* @param requestId 请求id
* @param serviceId 服务id
* @param commandName 命令名
* @param paras 命令参数
*/
onCommand: (requestId: string, serviceId: string, commandName: string, paras: object) => void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CommandListener AST#object_type#Left { /**
* 命令处理
*
* @param requestId 请求id
* @param serviceId 服务id
* @param commandName 命令名
* @param paras 命令参数
*/ AST#type_member#Left onCommand : AST#type_annotation#Left AST#fun... | export interface CommandListener {
onCommand: (requestId: string, serviceId: string, commandName: string, paras: object) => void;
} | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/listener/CommandListener.ets#L18-L28 | f6daefbcc518caf6d4a2ff5da9f3cba760bf5efd | github | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets | arkts | Defines ChipItemStyle.
@interface ChipItemStyle
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface ChipItemStyle {
/**
* Chip size.
*
* @type { ?(ChipSize | SizeOptions) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
size?: ChipSize | SizeOptions;
/**
* ChipItem background color.
*
* @t... | AST#export_declaration#Left export AST#interface_declaration#Left interface ChipItemStyle AST#object_type#Left { /**
* Chip size.
*
* @type { ?(ChipSize | SizeOptions) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#L... | export interface ChipItemStyle {
size?: ChipSize | SizeOptions;
backgroundColor?: ResourceColor;
fontColor?: ResourceColor;
selectedFontColor?: ResourceColor;
selectedBackgroundColor?: ResourceColor;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets#L153-L204 | 26405e2f8b59dbfa27c26ed8c93dd3f908a770bf | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets | arkts | 常量数据 | export const COMPONENT_STYLE: Record<string, number> = {
'ITEM_GUTTER': 12,
'TAG_TEXT_HEIGHT': 75,
'SUB_ITEM_GUTTER': 7,
'SUB_ITEM_HEIGHT': 96,
'SUB_ITEM_TEXT_WIDTH_TITLE': 56,
'SUB_ITEM_TEXT_HEIGHT': 12,
'SUB_ITEM_TEXT_WIDTH_BODY': 120,
'BOTTOM_TOAST_TEXT_MAX_HEIGHT': 200
}; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMPONENT_STYLE : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Rig... | export const COMPONENT_STYLE: Record<string, number> = {
'ITEM_GUTTER': 12,
'TAG_TEXT_HEIGHT': 75,
'SUB_ITEM_GUTTER': 7,
'SUB_ITEM_HEIGHT': 96,
'SUB_ITEM_TEXT_WIDTH_TITLE': 56,
'SUB_ITEM_TEXT_HEIGHT': 12,
'SUB_ITEM_TEXT_WIDTH_BODY': 120,
'BOTTOM_TOAST_TEXT_MAX_HEIGHT': 200
}; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets#L183-L192 | 09c80d9dd2377e4c2e1284de0b12443ef5e48ec1 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/constants/Constants.ets | arkts | 通用常量 | export default class CommonConstants {
/**
* 首页图片宽度
*/
public static readonly firstImageWidth = 762;
/**
* 首页图片高度
*/
public static readonly firstImageHeight = 431;
/**
* 首页图片从视频中截取的开始时间
*/
public static readonly FIRST_IMAGE_START_TIME = 1000;
/**
* 首页图片从视频中截取的结束时间
*/
public stati... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* 首页图片宽度
*/ AST#property_declaration#Left public static readonly firstImageWidth = AST#expression#Left 762 AST#expression#Right ; AST#property_declaration#Right /**
* 首页图片高度
*/ AST#property_... | export default class CommonConstants {
public static readonly firstImageWidth = 762;
public static readonly firstImageHeight = 431;
public static readonly FIRST_IMAGE_START_TIME = 1000;
public static readonly FIRST_IMAGE_END_TIME = 12000;
public static readonly PROGRESS_MAX = 100;
public s... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/constants/Constants.ets#L19-L56 | 1872f5a17921f0b4e1e0c540cba7db5b2b4cc934 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/data/FestivalData2025.ets | arkts | 节日数据管理类(2025年更新版)
优化版本:添加缓存机制提升查询性能 | export class FestivalData2025 {
// 缓存机制:按日期缓存节日数据(限制缓存大小防止内存泄漏)
private static festivalCache = new Map<string, FestivalInfo[]>();
private static legalHolidayCache = new Map<string, boolean>();
private static readonly MAX_CACHE_SIZE = 1000; // 最大缓存条目数
/**
* 生成缓存键
*/
private static getCacheKey(year: ... | AST#export_declaration#Left export AST#class_declaration#Left class FestivalData2025 AST#class_body#Left { // 缓存机制:按日期缓存节日数据(限制缓存大小防止内存泄漏) AST#property_declaration#Left private static festivalCache = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST... | export class FestivalData2025 {
private static festivalCache = new Map<string, FestivalInfo[]>();
private static legalHolidayCache = new Map<string, boolean>();
private static readonly MAX_CACHE_SIZE = 1000;
private static getCacheKey(year: number, month: number, day: number, isLunar: boolean): string... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L169-L385 | 2dab5dae868457fbdaf8738685dfc1434e426575 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets | arkts | MARK: - Distance Helper | export class DistanceHelper {
/**
* 返回 distance 的 UI 表示字符串
* @param distance 天数
* @returns +0天, +1天, +2天...
*/
static distanceString(distance: DistanceFromBase): string {
// 注意:LocalizedString 可以自行实现或从资源加载
if (distance === 1) {
return util.format(getString($r('app.string.distance_string_d... | AST#export_declaration#Left export AST#class_declaration#Left class DistanceHelper AST#class_body#Left { /**
* 返回 distance 的 UI 表示字符串
* @param distance 天数
* @returns +0天, +1天, +2天...
*/ AST#method_declaration#Left static distanceString AST#parameter_list#Left ( AST#parameter#Left distance : AST#type_annotat... | export class DistanceHelper {
static distanceString(distance: DistanceFromBase): string {
if (distance === 1) {
return util.format(getString($r('app.string.distance_string_day')), distance)
} else {
return util.format(getString($r('app.string.distance_string_days')), distance)
}
}
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/BoxType.ets#L22-L74 | 49808a43842e9837076682d7eb99dae49f97d769 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/navigation/DemoGraph.ets | arkts | register | 注册 Demo 模块导航路由
@returns {void} 无返回值 | register(): void {
RouteBuild.register(DemoRoutes.NetworkDemo, wrapBuilder(NetworkDemoNav));
RouteBuild.register(DemoRoutes.NetworkListDemo, wrapBuilder(NetworkListDemoNav));
RouteBuild.register(DemoRoutes.Database, wrapBuilder(DatabaseNav));
RouteBuild.register(DemoRoutes.LocalStorage, wrapBuilder(Loca... | AST#method_declaration#Left register 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#expression#Left... | register(): void {
RouteBuild.register(DemoRoutes.NetworkDemo, wrapBuilder(NetworkDemoNav));
RouteBuild.register(DemoRoutes.NetworkListDemo, wrapBuilder(NetworkListDemoNav));
RouteBuild.register(DemoRoutes.Database, wrapBuilder(DatabaseNav));
RouteBuild.register(DemoRoutes.LocalStorage, wrapBuilder(Loca... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/DemoGraph.ets#L23-L34 | 55fce123ae269f49ca5d6985436857e237a2f01d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | getContactAvatarColor | 根据关系获取头像颜色 | private getContactAvatarColor(relation: string): string {
const colorMap: Record<string, string> = {
'父亲': this.COLORS.primary,
'母亲': this.COLORS.redPrimary,
'兄弟': this.COLORS.greenPrimary,
'姐妹': this.COLORS.orangePrimary,
'朋友': this.COLORS.primary,
'同事': this.COLORS.gray600,
... | AST#method_declaration#Left private getContactAvatarColor AST#parameter_list#Left ( AST#parameter#Left relation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string ... | private getContactAvatarColor(relation: string): string {
const colorMap: Record<string, string> = {
'父亲': this.COLORS.primary,
'母亲': this.COLORS.redPrimary,
'兄弟': this.COLORS.greenPrimary,
'姐妹': this.COLORS.orangePrimary,
'朋友': this.COLORS.primary,
'同事': this.COLORS.gray600,
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4008-L4022 | b1fcd13a0a2c15d3b38d3421c7d668dd4347b8f8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | recordUserAction | 记录用户行为 | async recordUserAction(action: UserAction): Promise<void> {
try {
let behaviorData = this.userBehaviorCache.get(action.targetId);
if (!behaviorData) {
behaviorData = await this.createDefaultBehaviorData(action.targetId);
}
// 添加新动作
behaviorData.actions.push(action);
... | AST#method_declaration#Left async recordUserAction AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left UserAction 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_... | async recordUserAction(action: UserAction): Promise<void> {
try {
let behaviorData = this.userBehaviorCache.get(action.targetId);
if (!behaviorData) {
behaviorData = await this.createDefaultBehaviorData(action.targetId);
}
behaviorData.actions.push(action);
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L320-L350 | bc693e832721530e948e50fdb4eb13fc6f379712 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets | arkts | @file 搜索历史本地数据源实现
@author Joker.X | export class SearchHistoryLocalDataSourceImpl implements SearchHistoryLocalDataSource {
/**
* 迁移标记,防止重复执行 migrate
*/
private static migrated: boolean = false;
/**
* ORM 实例,用于执行数据库操作
*/
private orm = getORM();
/**
* 构造函数,初始化 ORM 并确保搜索历史表已迁移
* @returns {SearchHistoryLocalDataSourceImpl} 实例
... | AST#export_declaration#Left export AST#class_declaration#Left class SearchHistoryLocalDataSourceImpl AST#implements_clause#Left implements SearchHistoryLocalDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 迁移标记,防止重复执行 migrate
*/ AST#property_declaration#Left private static migrated : AST#type_an... | export class SearchHistoryLocalDataSourceImpl implements SearchHistoryLocalDataSource {
private static migrated: boolean = false;
private orm = getORM();
constructor() {
this.ensureMigrated();
}
private ensureMigrated(): void {
if (!SearchHistoryLocalDataSourceImpl.migrated) {
this... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L10-L128 | 713149e8c31d673ccba289a93e6c79dcf13ccadd | github | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSSpeechAICaption/entry/src/main/ets/pages/Index.ets | arkts | startCaptionRecognition | 开启字幕识别 | private startCaptionRecognition() {
// 读取本地视频的音频数据
this.getUIContext().getHostContext()?.resourceManager.getMediaContent($r('app.media.huawei_mate_40').id, 0)
.then((value: Uint8Array) => {
const audioBuffer = value
// 分块传入音频数据,避免一次性加载卡顿
// 每块大小为1280字节
const bufferSize = 1... | AST#method_declaration#Left private startCaptionRecognition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 读取本地视频的音频数据 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expressi... | private startCaptionRecognition() {
this.getUIContext().getHostContext()?.resourceManager.getMediaContent($r('app.media.huawei_mate_40').id, 0)
.then((value: Uint8Array) => {
const audioBuffer = value
const bufferSize = 1280
let offset = 0
const totalLen... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSSpeechAICaption/entry/src/main/ets/pages/Index.ets#L57-L86 | c460cc3d2b0e0161535e70b08f18d723967ab8f0 | gitee |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/pages/SearchStockPage.ets | arkts | _removeSelfStock | 从自选股数据库中删除自选股
@param bean | _removeSelfStock(bean: SearchStockBean) {
this.needRefreshSelfList = true
this.selfStockTable.deleteDataByCode(bean.code, (result) => {
console.log("删除自选股结果:" + result)
if (result > 0) {
this.dataSource.getAllData().forEach((item: SearchStockBean, index) => {
if (item.code == bean.... | AST#method_declaration#Left _removeSelfStock AST#parameter_list#Left ( AST#parameter#Left bean : AST#type_annotation#Left AST#primary_type#Left SearchStockBean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left A... | _removeSelfStock(bean: SearchStockBean) {
this.needRefreshSelfList = true
this.selfStockTable.deleteDataByCode(bean.code, (result) => {
console.log("删除自选股结果:" + result)
if (result > 0) {
this.dataSource.getAllData().forEach((item: SearchStockBean, index) => {
if (item.code == bean.... | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/SearchStockPage.ets#L122-L138 | 1b495fb0cddbd39b28480e529129f9ef753959b6 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/AddressRepository.ets | arkts | updateAddress | 修改地址
@param params 地址信息
@returns 修改结果 | async updateAddress(params: Address): Promise<NetworkResponse<void>> {
return this.networkDataSource.updateAddress(params);
} | AST#method_declaration#Left async updateAddress AST#parameter_list#Left ( AST#parameter#Left params : 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 AST#generic_type#L... | async updateAddress(params: Address): Promise<NetworkResponse<void>> {
return this.networkDataSource.updateAddress(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AddressRepository.ets#L27-L29 | b04bbb1f665d54798f589449f6e099e5f8ce0f1f | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | animation/entry/src/main/ets/pages/MultipleProperties.ets | arkts | MultipleProperties | [Start multiple_properties] [Start one_func] | @Component
export struct MultipleProperties {
@State w:number = 150
@State h:number = 2
@State brightNum:number = 1.5
@State color:Color = Color.Red
// [StartExclude one_func]
// Animation closure 1, set width change
func1() {
this.getUIContext().animateTo({curve: Curve.Sharp, duration: 1000}, () => {... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MultipleProperties AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right w : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annot... | @Component
export struct MultipleProperties {
@State w:number = 150
@State h:number = 2
@State brightNum:number = 1.5
@State color:Color = Color.Red
func1() {
this.getUIContext().animateTo({curve: Curve.Sharp, duration: 1000}, () => {
this.w = (this.w === 80 ? 150 : 80);
});
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/animation/entry/src/main/ets/pages/MultipleProperties.ets#L18-L30 | 0efcb3b26d163c28ef029a259c11cfbf6c04e47d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets | arkts | 行为模式接口 | export interface BehaviorPattern {
type: string;
frequency: number;
averageDuration: number;
preferredTime: string;
seasonality?: SeasonalityData;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BehaviorPattern AST#object_type#Left { AST#type_member#Left type : 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 frequency : AST#type_annotati... | export interface BehaviorPattern {
type: string;
frequency: number;
averageDuration: number;
preferredTime: string;
seasonality?: SeasonalityData;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L217-L223 | 238a3b5e2baa268ad9061c65e59d87164be75241 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shareimagepage/Index.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 * from './src/main/ets/components/ShareImagePage' | AST#export_declaration#Left export * from './src/main/ets/components/ShareImagePage' AST#export_declaration#Right | export * from './src/main/ets/components/ShareImagePage' | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shareimagepage/Index.ets#L16-L16 | 69f11a50a085d90027b66a5778e7e392e2162817 | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/utils/FileUtils.ets | arkts | readFileSync | 读取路径path的文件
@param path 文件绝对路径 | readFileSync(path: string): ArrayBuffer | undefined {
try {
if (fs.accessSync(path)) {
let length = fs.statSync(path).size
let buf = new ArrayBuffer(length);
let fd = fs.openSync(path, fs.OpenMode.READ_ONLY).fd;
fs.readSync(fd, buf)
fs.closeSync(fd)
return buf
... | AST#method_declaration#Left readFileSync 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#union_type#Left AST#primary_type#Left ArrayBuf... | readFileSync(path: string): ArrayBuffer | undefined {
try {
if (fs.accessSync(path)) {
let length = fs.statSync(path).size
let buf = new ArrayBuffer(length);
let fd = fs.openSync(path, fs.OpenMode.READ_ONLY).fd;
fs.readSync(fd, buf)
fs.closeSync(fd)
return buf
... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L147-L162 | b47e5d2242477af77a4493056003b02d83feabf0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets | arkts | attach | TODO 知识点:绑定输入法 | async attach() {
await this.inputController.attach(true, this.textConfig);
logger.info("attached");
} | AST#method_declaration#Left async attach AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#... | async attach() {
await this.inputController.attach(true, this.textConfig);
logger.info("attached");
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets#L96-L99 | 5f7317e2e1ccc3513f3dc83f3c1029b329742b08 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/component/base.ets | arkts | aboutToRecycle | aboutToRecycle Method.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | abstract aboutToRecycle(): void; | AST#method_declaration#Left abstract aboutToRecycle 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#method_declaration#Right | abstract aboutToRecycle(): void; | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/component/base.ets#L86-L86 | f17e71d880d43aa2d274da53cd7a66525ff391b3 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Utils.ets | arkts | Utilities class that has some helper methods. Needs to be initialized by
calling Utils.init(...) before usage. Inside the Chart.init() method, this is
done, if the Utils are used before that, Utils.init(...) needs to be called
manually. | export default abstract class Utils {
private static scaledDensity: number = 3.3125;
private static mMinimumFlingVelocity: number = 50;
private static mMaximumFlingVelocity: number = 8000;
public static DEG2RAD: number = (Math.PI / 180.0);
public static FDEG2RAD: number = (Math.PI / 180.0);
public static DO... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class Utils AST#class_body#Left { AST#property_declaration#Left private static scaledDensity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3.3125 AST#expression... | export default abstract class Utils {
private static scaledDensity: number = 3.3125;
private static mMinimumFlingVelocity: number = 50;
private static mMaximumFlingVelocity: number = 8000;
public static DEG2RAD: number = (Math.PI / 180.0);
public static FDEG2RAD: number = (Math.PI / 180.0);
public static DO... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L36-L324 | 7ee38f116854c5950a7bdd6432030aa688f1725d | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | LunarCalendar_Fixed.ets | arkts | getLunarYearDays | 获取农历年总天数 | private static getLunarYearDays(lunarYear: number): number {
if (lunarYear < 1900 || lunarYear > 2100) {
return 354; // 默认值
}
return RealLunarYearDays.getDays(lunarYear);
} | AST#method_declaration#Left private static getLunarYearDays AST#parameter_list#Left ( AST#parameter#Left lunarYear : 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 numb... | private static getLunarYearDays(lunarYear: number): number {
if (lunarYear < 1900 || lunarYear > 2100) {
return 354;
}
return RealLunarYearDays.getDays(lunarYear);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/LunarCalendar_Fixed.ets#L283-L288 | d4c6bfed8efc63e1073ab2dbe09cb20f833116c6 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | getLastGesture | Returns the last gesture that has been performed on the chart.
@return | public getLastGesture(): ChartGesture {
return this.mLastGesture;
} | AST#method_declaration#Left public getLastGesture AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ChartGesture AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#mem... | public getLastGesture(): ChartGesture {
return this.mLastGesture;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/ChartTouchListener.ets#L121-L123 | e46660d667d8d02b34e6c41c6b4cbf0e59eb0817 | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 项目分类下列表
@param date
@returns | export function projectCategoryItemList(cid:number,page:number) {
return axiosClient.get<HomeArticleModel>({
url: `project/list/${page}/json?cid=${cid}`,
showLoading:page == 0
})
} | AST#export_declaration#Left export AST#function_declaration#Left function projectCategoryItemList AST#parameter_list#Left ( AST#parameter#Left cid : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#... | export function projectCategoryItemList(cid:number,page:number) {
return axiosClient.get<HomeArticleModel>({
url: `project/list/${page}/json?cid=${cid}`,
showLoading:page == 0
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L181-L186 | ea6144757a45743ef06e29517fc77a88c732a266 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/auth/AuthUtil.ets | arkts | checkPermissions | 判断是否授权
@param permissions 待判断的权限
@returns 已授权true,未授权false | static checkPermissions(permissions: Permissions): boolean {
//判断是否授权
let grantStatus: abilityAccessCtrl.GrantStatus = AuthUtil.checkAccessToken(permissions);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
//已经授权
return true;
} else {
//未授权
return false;
... | AST#method_declaration#Left static checkPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boole... | static checkPermissions(permissions: Permissions): boolean {
let grantStatus: abilityAccessCtrl.GrantStatus = AuthUtil.checkAccessToken(permissions);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
return true;
} else {
return false;
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/auth/AuthUtil.ets#L65-L75 | 774d477d18a90fd04847a9b64cd1ac182d24b096 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | recordTaskCompletion | 记录任务完成 | async recordTaskCompletion(completed: number, total: number): Promise<void> {
const today = DateUtils.getTodayKey();
if (!this.stats.dailyStats[today]) {
this.stats.dailyStats[today] = {
tasksCompleted: 0,
tasksTotal: 0,
focusTime: 0,
pomodoroSessions: 0,
achieveme... | AST#method_declaration#Left async recordTaskCompletion AST#parameter_list#Left ( AST#parameter#Left completed : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left total : AST#type_annotation#Left AST#primary_type#Left number AS... | async recordTaskCompletion(completed: number, total: number): Promise<void> {
const today = DateUtils.getTodayKey();
if (!this.stats.dailyStats[today]) {
this.stats.dailyStats[today] = {
tasksCompleted: 0,
tasksTotal: 0,
focusTime: 0,
pomodoroSessions: 0,
achieveme... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L205-L228 | 9edb655cd44319e33358a771a9d96778d903acb8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildMyFavorites | 我的收藏 | @Builder
buildMyFavorites() {
Column({ space: 16 }) {
Row() {
Text('❤️ 我的收藏')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`${this.getRealFavoriteCount()}条`)
.fontSize(14)
.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMyFavorites 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
buildMyFavorites() {
Column({ space: 16 }) {
Row() {
Text('❤️ 我的收藏')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`${this.getRealFavoriteCount()}条`)
.fontSize(14)
.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3321-L3371 | 483c429232a80feed596dc3386b0afb7921c0d7d | github |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/FlowLocale.ets | arkts | fromTag | Constructs a new FlorisLocale from given string.
@param str Either a language or locale tag in string form.
@return A new FlorisLocale. | public static fromTag(str: string): FlorisLocale {
if (str.match(FLorisLocale.DELIMITER_SPLITTER)) {
const lc: string[] = str.split(FLorisLocale.DELIMITER_SPLITTER);
if (lc.length >= 3) {
return FlorisLocale.from(lc[0], lc[1], lc[2]);
} else {
return FlorisLocale.from(lc[0], lc[1])... | AST#method_declaration#Left public static fromTag AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FlorisLocale AST#pri... | public static fromTag(str: string): FlorisLocale {
if (str.match(FLorisLocale.DELIMITER_SPLITTER)) {
const lc: string[] = str.split(FLorisLocale.DELIMITER_SPLITTER);
if (lc.length >= 3) {
return FlorisLocale.from(lc[0], lc[1], lc[2]);
} else {
return FlorisLocale.from(lc[0], lc[1])... | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L78-L89 | b03046a52077d918dc2f5904010556a21252c11d | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets | arkts | handleAuthResultAndCanceling | [End authentication_example4] [Start cancel_authentication] | handleAuthResultAndCanceling(userAuthInstance: userAuth.UserAuthInstance, exampleNumber: number) {
// [StartExclude cancel_authentication]
try {
// userAuthInstance.on异常抛出层
userAuthInstance.on('result', {
onResult: (result: userAuth.UserAuthResult) => {
this.result[exampleNumber] =... | AST#method_declaration#Left handleAuthResultAndCanceling AST#parameter_list#Left ( AST#parameter#Left userAuthInstance : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . UserAuthInstance AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#... | handleAuthResultAndCanceling(userAuthInstance: userAuth.UserAuthInstance, exampleNumber: number) {
try {
userAuthInstance.on('result', {
onResult: (result: userAuth.UserAuthResult) => {
this.result[exampleNumber] = (`${result.result}`);
try {
tr... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L318-L360 | 941dda00c16c209becba6c1e150137fcf22dfa2b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | saveLearn | / 保存此plan中,指定num + distance + pieceNo + wordId的学习记录 | private saveLearn(num: number, distance: number, pieceNo: number, wordId: number): void {
if (this.planId === null) return;
let learn = new Learn();
learn.planId = this.planId;
learn.bookId = this.bookId;
learn.num = num;
learn.distance = distance;
learn.pieceNo = piece... | AST#method_declaration#Left private saveLearn AST#parameter_list#Left ( AST#parameter#Left num : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left distance : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | private saveLearn(num: number, distance: number, pieceNo: number, wordId: number): void {
if (this.planId === null) return;
let learn = new Learn();
learn.planId = this.planId;
learn.bookId = this.bookId;
learn.num = num;
learn.distance = distance;
learn.pieceNo = piece... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L290-L316 | 7a4a813574eb4109939c992a7b72ac72c82c3fe5 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/personal/src/main/ets/pages/QuickLoginPage.ets | arkts | handleLoginWithHuaweiIDButton | 处理点击一键登录后的方法 | handleLoginWithHuaweiIDButton(error: BusinessError | undefined,
response: loginComponentManager.HuaweiIDCredential) {
this.enableStatus = false;
// if部分内容配置好可用的调试证书和client_id后再放开
if (error) {
hilog.error(this.domainId, this.logTag,
`Failed to click LoginWithHuaweiIDButton. Code is ${error.... | AST#method_declaration#Left handleLoginWithHuaweiIDButton AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BusinessError AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right A... | handleLoginWithHuaweiIDButton(error: BusinessError | undefined,
response: loginComponentManager.HuaweiIDCredential) {
this.enableStatus = false;
if (error) {
hilog.error(this.domainId, this.logTag,
`Failed to click LoginWithHuaweiIDButton. Code is ${error.code}, message is ${error.message... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/personal/src/main/ets/pages/QuickLoginPage.ets#L71-L147 | a51290380a38484f227dd576c809c5349bc57c8c | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/practice/TrainTimePage.ets | arkts | OneWeekTrainTime | ************************************统计图处理********************************************* | @Builder
OneWeekTrainTime(workoutdata:WorkoutData,day:number){
Column(){
Row(){
Text(this.Month.toString()+'月'+day.toString()+'日-'+this.Month.toString()+'月'+(day+6).toString()+'日')
.fontSize(20)
.fontColor('#222B45')
.fontWeight('500')
Row(){
Text(work... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right OneWeekTrainTime AST#parameter_list#Left ( AST#parameter#Left workoutdata : AST#type_annotation#Left AST#primary_type#Left WorkoutData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left day : AST#type_ann... | @Builder
OneWeekTrainTime(workoutdata:WorkoutData,day:number){
Column(){
Row(){
Text(this.Month.toString()+'月'+day.toString()+'日-'+this.Month.toString()+'月'+(day+6).toString()+'日')
.fontSize(20)
.fontColor('#222B45')
.fontWeight('500')
Row(){
Text(work... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainTimePage.ets#L81-L140 | 46f16ad0ce94001b102a03b3ee67347d35004c85 | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/SearchSchedule.ets | arkts | ScheduleItemHeader | 已完成的 ScheduleItem 组件所在 ListItemGroup 的标题组件。 | @Builder
private ScheduleItemHeader(): void {
Row() {
Text('已完成')
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r('app.color.font_black'));
}
.padding('1%')
.size({ width: '96%', height: '4%' })
.border({
radius: 12,
style: BorderStyle.Solid,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ScheduleItemHeader 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 A... | @Builder
private ScheduleItemHeader(): void {
Row() {
Text('已完成')
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r('app.color.font_black'));
}
.padding('1%')
.size({ width: '96%', height: '4%' })
.border({
radius: 12,
style: BorderStyle.Solid,
... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/SearchSchedule.ets#L157-L181 | 5b334aec19751735e257b219300f05c058cabde8 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets | arkts | decode | 解密
@param decodeStr 待解密的字符串
@param priKey SM2私钥 | static async decode(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsym(str, priKey, 'SM2_256', 'SM2_256|SM3', 256);
} | AST#method_declaration#Left static async decode AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static async decode(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsym(str, priKey, 'SM2_256', 'SM2_256|SM3', 256);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L50-L52 | 75027c6740fa54f7b90f459adef8aec351030f3f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets | arkts | reload | 重新加载数据 | public reload(): void {
this.notifyDataReload();
} | AST#method_declaration#Left public reload 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#expression... | public reload(): void {
this.notifyDataReload();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L171-L173 | bf197bbd6a5617bb4fccc4eab3c1f52d0a8f0341 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets | arkts | totalCount | 获取数组长度。
@returns {number} 返回数组长度。 | public totalCount(): number {
return this.dataArray.length;
} | AST#method_declaration#Left public totalCount 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#member_expres... | public totalCount(): number {
return this.dataArray.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L36-L38 | cc567c1cca64bfa3f4bb3807f6e65e43d967dc57 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets | arkts | setReminder | 处理提醒 | async setReminder(task: Task) {
if (!task.reminderTime) return;
try {
// 先取消已有提醒
if (this.reminderId >= 0) {
await this.cancelReminder();
}
const reminderDateTime = new Date(task.reminderTime);
// 创建提醒请求
let reminderRequest: reminderAgent.ReminderRe... | AST#method_declaration#Left async setReminder AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( A... | async setReminder(task: Task) {
if (!task.reminderTime) return;
try {
if (this.reminderId >= 0) {
await this.cancelReminder();
}
const reminderDateTime = new Date(task.reminderTime);
let reminderRequest: reminderAgent.ReminderRequestCalendar = {
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L322-L390 | 13c3efd4dcee890c1baa5f8aa98b4698998520a8 | github |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/MessageApi.type.ets | arkts | 消息总数量和未读 | export interface UserMessageCount {
/**
* 总消息数量
*/
totalQuantity: number
/**
* 总未读数量
*/
totalUnReadQuantity: number
/**
* 系统消息未读数量
*/
systemUnReadQuantity: number
/**
* 通知公告消息未读数量
*/
noticeUnReadQuantity: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserMessageCount AST#object_type#Left { /**
* 总消息数量
*/ AST#type_member#Left totalQuantity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /**
* 总未读数量
*/ ... | export interface UserMessageCount {
totalQuantity: number
totalUnReadQuantity: number
systemUnReadQuantity: number
noticeUnReadQuantity: number
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/MessageApi.type.ets#L55-L72 | d2bf55101f1c49729d02dfd54c2997e82418f6c2 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderDetailPage.ets | arkts | OrderDetailPage | @file 订单详情页面视图
@author Joker.X | @ComponentV2
export struct OrderDetailPage {
/**
* 订单详情页面 ViewModel
*/
@Local
private vm: OrderDetailViewModel = new OrderDetailViewModel();
/**
* 当前窗口安全区状态
*/
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
/**
* 构建订单详情页面
* @returns {void} 无返回值
*/... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderDetailPage AST#component_body#Left { /**
* 订单详情页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Orde... | @ComponentV2
export struct OrderDetailPage {
@Local
private vm: OrderDetailViewModel = new OrderDetailViewModel();
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
build() {
AppNavDestination({
title: this.getPageTitle(),
viewModel: this.vm,
p... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L32-L520 | 2d7f0ae9fa9f0445589e13feaf69b5e7413ae0d1 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/FileManagement/Picker/entry/src/main/ets/pages/EditFile.ets | arkts | callFilePickerSaveFile | 拉起picker保存文件 | async callFilePickerSaveFile(): Promise<void> {
try {
let DocumentSaveOptions = new picker.DocumentSaveOptions();
DocumentSaveOptions.newFileNames = ['MyDocument_01.txt'];
let documentPicker = new picker.DocumentViewPicker();
documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult)... | AST#method_declaration#Left async callFilePickerSaveFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | async callFilePickerSaveFile(): Promise<void> {
try {
let DocumentSaveOptions = new picker.DocumentSaveOptions();
DocumentSaveOptions.newFileNames = ['MyDocument_01.txt'];
let documentPicker = new picker.DocumentViewPicker();
documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult)... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/FileManagement/Picker/entry/src/main/ets/pages/EditFile.ets#L90-L109 | d19ef6dde779610c4b15c313a3bce96992749c7d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | encryptSync | 加密,同步
@param data 加密或者解密的数据。data不能为null。
@param pubKey 指定加密公钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
@returns | static encryptSync(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, pubKey, null, transformation);
} | AST#method_declaration#Left static encryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey :... | static encryptSync(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob {
return CryptoUtil.encryptSync(data, pubKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L52-L55 | f6a94af4ae6f170b199b36afe07a38a06f4bbeec | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets | arkts | getData | 获取指定索引数据。
@param {number} index - 索引值。
@returns {CustomDataType} 返回指定索引数据。 | public getData(index: number): CustomDataType {
return this.dataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primar... | public getData(index: number): CustomDataType {
return this.dataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets#L154-L156 | b18238d27b5fee2c9466c840f4a3c7f8e5769b92 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets | arkts | handleCustomAuthResult | [End cancel_authentication] [Start custom_authentication] | handleCustomAuthResult(userAuthInstance: userAuth.UserAuthInstance, exampleNumber: number) {
// [StartExclude custom_authentication]
try {
// [EndExclude custom_authentication]
// userAuthInstance.on异常抛出层
userAuthInstance.on('result', {
onResult: (result: userAuth.UserAuthResult) => {
... | AST#method_declaration#Left handleCustomAuthResult AST#parameter_list#Left ( AST#parameter#Left userAuthInstance : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . UserAuthInstance AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parame... | handleCustomAuthResult(userAuthInstance: userAuth.UserAuthInstance, exampleNumber: number) {
try {
userAuthInstance.on('result', {
onResult: (result: userAuth.UserAuthResult) => {
this.result[exampleNumber] = (`${result.result}`);
try {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L394-L445 | 4ab2f6d6b1491d55745b5e6d25617f30f0bd4039 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getMonthStart | 获取本月的开始日期
@returns 本月1号的日期 | static getMonthStart(): Date {
const today = new Date();
return new Date(today.getFullYear(), today.getMonth(), 1);
} | AST#method_declaration#Left static getMonthStart AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toda... | static getMonthStart(): Date {
const today = new Date();
return new Date(today.getFullYear(), today.getMonth(), 1);
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L56-L59 | 7bcd3b818555c80ac9ccfbf565078e0c2aaf5308 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | products/entry/src/main/ets/pages/navdest/CustomCompLifecycleObserver.ets | arkts | CustomCompLifecycleObserver | @author: HZWei
@date: 2024/11/19
@desc: | @ZLifecycle({ name: RouterConstants.CUSTOM_COMPONENT_CHILD_VIEW })
@Observed
export class CustomCompLifecycleObserver extends ZLifecycleObserver {
counter = 0
onReady(context: NavDestinationContext): void {
}
onBackPress(): boolean {
return false
}
onAppear(info: RouterInfo): void {
console.log("o... | AST#decorated_export_declaration#Left AST#decorator#Left @ ZLifecycle ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RouterConstants AST#expression#Right . CUSTOM_COMPON... | @ZLifecycle({ name: RouterConstants.CUSTOM_COMPONENT_CHILD_VIEW })
@Observed
export class CustomCompLifecycleObserver extends ZLifecycleObserver {
counter = 0
onReady(context: NavDestinationContext): void {
}
onBackPress(): boolean {
return false
}
onAppear(info: RouterInfo): void {
console.log("o... | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/navdest/CustomCompLifecycleObserver.ets#L9-L22 | 6bcfa57f8b7be6eb37135316f0dd95c20611badc | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets | arkts | receiveCoupon | 领取优惠券
@param {ReceiveCouponRequest} request - 领取参数
@returns {Promise<NetworkResponse<string>>} 领取结果 | async receiveCoupon(request: ReceiveCouponRequest): Promise<NetworkResponse<string>> {
const resp: AxiosResponse<NetworkResponse<string>> =
await NetworkClient.http.post("market/coupon/user/receive", request);
return resp.data;
} | AST#method_declaration#Left async receiveCoupon AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left ReceiveCouponRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#... | async receiveCoupon(request: ReceiveCouponRequest): Promise<NetworkResponse<string>> {
const resp: AxiosResponse<NetworkResponse<string>> =
await NetworkClient.http.post("market/coupon/user/receive", request);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets#L16-L20 | b1d6ceffd8b8bd6f316a30da7d8aaae943c8f8b0 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/class.ets | arkts | recommendContent | **************************评论**************************// | @Builder
recommendContent() {
Column() {
Text('课程评价')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ top: 15 })
.width('100%')
Row() {
Image('/image/home/class7.png')
.width(50)
.height(50)
.margin({ right: 10 })
Text... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right recommendContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui... | @Builder
recommendContent() {
Column() {
Text('课程评价')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ top: 15 })
.width('100%')
Row() {
Image('/image/home/class7.png')
.width(50)
.height(50)
.margin({ right: 10 })
Text... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/class.ets#L473-L515 | 54008a24f554d772d0f05e427c45ea4d5425425e | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindMenu.ets | arkts | BindMenuBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function BindMenuBuilder(name: string, param: Object) {
MenuExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindMenuBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param... | @Builder
export function BindMenuBuilder(name: string, param: Object) {
MenuExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindMenu.ets#L16-L19 | e655d6261bda592d89ca48067f3842f83add7a1b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets | arkts | contentListNoMoreBuilder | 内容底部"没有更多"视图 | @Builder
contentListNoMoreBuilder() {
ListItem() {
Text($r('app.string.secondarylinkage_nomore'))
.fontColor($r('sys.color.ohos_fa_text_secondary'))
}
.width('100%')
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right contentListNoMoreBuilder 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 ListItem ( ) AST#container_content_body#Left { AS... | @Builder
contentListNoMoreBuilder() {
ListItem() {
Text($r('app.string.secondarylinkage_nomore'))
.fontColor($r('sys.color.ohos_fa_text_secondary'))
}
.width('100%')
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets#L136-L143 | be4739724ad6617c5840f8fbfb26a8bb88d770e2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/swipersmoothvariation/src/main/ets/pages/MainPage.ets | arkts | GridBuilderFunction | 自定义构建函数,生成每一个swiper页面的函数 | @Builder
GridBuilderFunction(page: GridItemInfo[], height: number, template: string) {
Column() {
Grid(this.gridScroller) {
ForEach(page, (item: GridItemInfo) => {
GridItem() {
ViewItem({ item: item })
.onClick(() => {
this.dialog.open();
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right GridBuilderFunction AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GridItemInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Rig... | @Builder
GridBuilderFunction(page: GridItemInfo[], height: number, template: string) {
Column() {
Grid(this.gridScroller) {
ForEach(page, (item: GridItemInfo) => {
GridItem() {
ViewItem({ item: item })
.onClick(() => {
this.dialog.open();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipersmoothvariation/src/main/ets/pages/MainPage.ets#L158-L172 | 38b73a981c0161842c75669192714ef14c2c2188 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | needsOffset | Returns true if this axis needs horizontal offset, false if no offset is needed.
@return | public needsOffset(): boolean {
if (super.isEnabled() && super.isDrawLabelsEnabled() &&
this.getLabelPosition() == YAxisLabelPosition.OUTSIDE_CHART) {
return true;
} else {
return false;
}
} | AST#method_declaration#Left public needsOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression... | public needsOffset(): boolean {
if (super.isEnabled() && super.isDrawLabelsEnabled() &&
this.getLabelPosition() == YAxisLabelPosition.OUTSIDE_CHART) {
return true;
} else {
return false;
}
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L389-L396 | 82bed4acac4501adbec9d6a5e4fc0bd602d3a50c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets | arkts | downloadConfig | 获取当前页面的上下文 配置下载参数,这里以简单配置url为例 | function downloadConfig(downloadUrl: string): request.agent.Config {
// TODO 知识点:配置下载参数。一个下载任务需要配置对应一套下载参数request.agent.Config。本例中使用downloadConfig方法简单配置了下载文件的url,实际业务中请按实际情况按需配置。
const config: request.agent.Config = {
action: request.agent.Action.DOWNLOAD, // 配置任务选项,这里配置为下载任务
url: downloadUrl, // 配置下载任务url
... | AST#function_declaration#Left function downloadConfig AST#parameter_list#Left ( AST#parameter#Left downloadUrl : 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#qual... | function downloadConfig(downloadUrl: string): request.agent.Config {
const config: request.agent.Config = {
action: request.agent.Action.DOWNLOAD,
url: downloadUrl,
overwrite: true,
method: 'GET',
saveas: './',
mode: request.agent.Mode.BACKGROUND,
gauge: true,
retry: false,
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets#L30-L43 | 428180447dc6f2db30a40692b0775bb1bc198299 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets | arkts | notifyDataChange | Notify the LazyForEach component that there is a change in the data at the index corresponding to the specified index, and that the child component at this index needs to be rebuilt. | notifyDataChange(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataChange(index);
})
} | AST#method_declaration#Left notifyDataChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | notifyDataChange(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataChange(index);
})
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L60-L64 | 7c58d20f1fa6f998a58bd72bcbe6faebf433a1d4 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets | arkts | applyLocationPermission | 向用户申请位置权限
@returns | static async applyLocationPermission(): Promise<boolean> {
const permissions: Permissions[] = [
'ohos.permission.APPROXIMATELY_LOCATION',
];
const isGrantedAppLo = await SystemSceneUtils.checkPermissionGrant(permissions[0]);
if (isGrantedAppLo) {
Logger.info('already granted location and ap... | AST#method_declaration#Left static async applyLocationPermission AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation... | static async applyLocationPermission(): Promise<boolean> {
const permissions: Permissions[] = [
'ohos.permission.APPROXIMATELY_LOCATION',
];
const isGrantedAppLo = await SystemSceneUtils.checkPermissionGrant(permissions[0]);
if (isGrantedAppLo) {
Logger.info('already granted location and ap... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets#L124-L152 | 675a950857feaf7d3dbd731a06b1193781792936 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | TODO 网络相关工具类
需要 ohos.permission.GET_NETWORK_INFO、ohos.permission.GET_WIFI_INFO 权限。
author: 桃花镇童长老
since: 2024/05/01 | export class NetworkUtil {
private static netConnection: connection.NetConnection;
/**
* 检查当前网络上的数据流量使用是否被计量
* @returns
*/
static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
}
/**
* 检查当前网络上的数据流量使用是否被计量
* @returns
*/
static isDefaultNetMet... | AST#export_declaration#Left export AST#class_declaration#Left class NetworkUtil AST#class_body#Left { AST#property_declaration#Left private static netConnection : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetConnection AST#qualified_type#Right AST#primary_type#Right AST#type_an... | export class NetworkUtil {
private static netConnection: connection.NetConnection;
static async isDefaultNetMetered(): Promise<boolean> {
return connection.isDefaultNetMetered();
}
static isDefaultNetMeteredSync(): boolean {
return connection.isDefaultNetMeteredSync();
}
static hasDefa... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L29-L434 | 72912350be080df069e2dd245118c90f55561b43 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkJsObject.ets | arkts | runJavaScriptExt | 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScriptExt需要在loadUrl完成后,比如onPageEnd中调用。
@param script JavaScript脚本。
@returns | async runJavaScriptExt(script: string | ArrayBuffer): Promise<webview.JsMessageExt> {
if (this.controller) {
return ArkWebHelper.runJavaScriptExt(this.controller, script);
}
return new webview.JsMessageExt();
} | AST#method_declaration#Left async runJavaScriptExt AST#parameter_list#Left ( AST#parameter#Left script : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#paramete... | async runJavaScriptExt(script: string | ArrayBuffer): Promise<webview.JsMessageExt> {
if (this.controller) {
return ArkWebHelper.runJavaScriptExt(this.controller, script);
}
return new webview.JsMessageExt();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L54-L59 | afc32e9d90b3e7245e50bc503bd65d977fc9def3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets | arkts | MonthViewItem | 时间计算工具类
月视图子组件 | @Component
export struct MonthViewItem {
// 月视图日期数据
@State monthDays: Day[][] = [];
// 年月信息
@Link @Watch('updateMonthData') yearMonth: string;
// 当前选中的日期
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0); // 当前选中的日期
// 当前选中的日期,... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MonthViewItem AST#component_body#Left { // 月视图日期数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right monthDays : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Day [ ] [ ... | @Component
export struct MonthViewItem {
@State monthDays: Day[][] = [];
@Link @Watch('updateMonthData') yearMonth: string;
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0);
,格式'year-month-date-week'
@Link @Watch('OnChan... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets#L25-L83 | da9936be55837a25364fbcbd0fa937f0e7b981a3 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsDetailRichHeader.ets | arkts | buildDetailTitle | 商品详情标题构建
@returns {void} 无返回值 | @Builder
private buildDetailTitle(): void {
TitleWithLine({ text: $r("app.string.goods_detail") });
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildDetailTitle 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_state... | @Builder
private buildDetailTitle(): void {
TitleWithLine({ text: $r("app.string.goods_detail") });
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailRichHeader.ets#L45-L48 | cbe2b795db9e7cd3b19fc5fc008b87844c6b1bd9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | 完整农历系统设计.ets | arkts | getYearConfig | 获取农历年配置 | public static getYearConfig(lunarYear: number): LunarYearConfig | null {
return AuthorityLunarDatabase.lunarYears.get(lunarYear) || null;
} | AST#method_declaration#Left public static getYearConfig AST#parameter_list#Left ( AST#parameter#Left lunarYear : 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#union_type#Left AST#primar... | public static getYearConfig(lunarYear: number): LunarYearConfig | null {
return AuthorityLunarDatabase.lunarYears.get(lunarYear) || null;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L220-L222 | b6779d3e34a7745294140770cccbe06ffa116a55 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/DataSource.ets | arkts | 好友数据 | export const PERSON_LIST: PersonData[] = [
{
wid: "10001",
headImg: $rawfile("group_avatar_user_header_image_1.png"),
name: "用户1"
},
{
wid: "10002",
headImg: $rawfile("group_avatar_user_header_image_2.png"),
name: "用户2"
},
{
wid: "10003",
headImg: $rawfile("group_avatar_user_he... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PERSON_LIST : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PersonData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#exp... | export const PERSON_LIST: PersonData[] = [
{
wid: "10001",
headImg: $rawfile("group_avatar_user_header_image_1.png"),
name: "用户1"
},
{
wid: "10002",
headImg: $rawfile("group_avatar_user_header_image_2.png"),
name: "用户2"
},
{
wid: "10003",
headImg: $rawfile("group_avatar_user_he... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/groupavatar/src/main/ets/datasource/DataSource.ets#L24-L75 | de7445f498dbf61e815984458b470cf85a557c68 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets | arkts | setCubicIntensity | Sets the intensity for cubic lines (if enabled). Max = 1f = very cubic,
Min = 0.05f = low cubic effect, Default: 0.2f
@param intensity | public setCubicIntensity(intensity: number): void {
if (intensity > 1) {
intensity = 1;
}
if (intensity < 0.05) {
intensity = 0.05;
}
this.mCubicIntensity = intensity;
} | AST#method_declaration#Left public setCubicIntensity AST#parameter_list#Left ( AST#parameter#Left intensity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr... | public setCubicIntensity(intensity: number): void {
if (intensity > 1) {
intensity = 1;
}
if (intensity < 0.05) {
intensity = 0.05;
}
this.mCubicIntensity = intensity;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets#L135-L143 | a15579a1ee925d9bf917341b6bb55f40cddbbe28 | gitee |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/common/utils/Request.ets | arkts | delete | DELETE 请求
@param url 接口地址 | static async delete<T>(url: string): Promise<T> {
return instance.delete<T, T, null>(url);
} | AST#method_declaration#Left static async delete AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right 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#paramete... | static async delete<T>(url: string): Promise<T> {
return instance.delete<T, T, null>(url);
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/common/utils/Request.ets#L58-L60 | 30b978b1bd524b8c76deb0d10558100f3c112e9b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | getCurrentPath | 获取当前页面路径 | getCurrentPath(): string {
try {
const state = router.getState();
return state.path || '';
} catch (error) {
hilog.error(0x0001, 'BirthdayReminder',
`Failed to get current path: ${error}`);
return '';
}
} | AST#method_declaration#Left getCurrentPath 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left ... | getCurrentPath(): string {
try {
const state = router.getState();
return state.path || '';
} catch (error) {
hilog.error(0x0001, 'BirthdayReminder',
`Failed to get current path: ${error}`);
return '';
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L185-L194 | 8da1646262a784267a8bc6a7e4257cd1ddf9375f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/analytics/AnalyticsService.ets | arkts | getOverviewStats | 获取总览统计 | async getOverviewStats(): Promise<OverviewStats> {
const contacts = await this.contactService.searchContacts({ pageSize: 10000 });
const greetings = await this.greetingService.searchGreetings({ pageSize: 10000 });
const now = new Date();
const todayBirthdays = this.filterBirthdaysByDays(contacts, 0... | AST#method_declaration#Left async getOverviewStats 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 OverviewStats AST#primary_type#Right AST#type_annotation#Right >... | async getOverviewStats(): Promise<OverviewStats> {
const contacts = await this.contactService.searchContacts({ pageSize: 10000 });
const greetings = await this.greetingService.searchGreetings({ pageSize: 10000 });
const now = new Date();
const todayBirthdays = this.filterBirthdaysByDays(contacts, 0... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AnalyticsService.ets#L194-L238 | 2022fec135d64115e47a02ba0d91d78bf8f23ecc | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/attach/PresetAttach.ets | arkts | 弹窗预置挂件 | export enum PresetAttach {
/**
* 内部关闭按钮(搭配位置alignment使用)
*/
insideTopRightClose = 'insideTopRightClose',
/**
* 外部关闭按钮(搭配位置alignment使用)
*/
outsideBottomCenterClose = 'outsideBottomCenterClose',
} | AST#export_declaration#Left export AST#enum_declaration#Left enum PresetAttach AST#enum_body#Left { /**
* 内部关闭按钮(搭配位置alignment使用)
*/ AST#enum_member#Left insideTopRightClose = AST#expression#Left 'insideTopRightClose' AST#expression#Right AST#enum_member#Right , /**
* 外部关闭按钮(搭配位置alignment使用)
*/ AST#enum_mem... | export enum PresetAttach {
insideTopRightClose = 'insideTopRightClose',
outsideBottomCenterClose = 'outsideBottomCenterClose',
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/attach/PresetAttach.ets#L4-L13 | 89341483e12698bbacdefd5310a308fb3a45bc85 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | getDataText | 读取系统剪贴板纯文本内容,使用Promise异步回调。
@returns | static async getDataText(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryText();
} | AST#method_declaration#Left static async getDataText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#... | static async getDataText(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryText();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L128-L131 | ae44a05d05b7165f310597c134906b3c7b3a1809 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets | arkts | decodePKCS1Segment | 解密-分段
@param decodeStr 待解密的字符串
@param priKey RSA私钥 | static async decodePKCS1Segment(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | AST#method_declaration#Left static async decodePKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AS... | static async decodePKCS1Segment(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L96-L98 | 63971fe99f4209484f82c122011eb5ffa9a4a8ab | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/Base64Encoding.ets | arkts | decode | 将Base64字符串解码为原始文本
@param base64 Base64编码的字符串
@returns 解码后的原始文本 | static decode(base64: string): string {
if (!base64) {
return '';
}
// 移除所有非Base64字符
base64 = base64.replace(/[^A-Za-z0-9+/=]/g, '');
let result = '';
let i = 0;
const len = base64.length;
while (i < len) {
// 获取四个Base64字符
const e1 = Base64Encoding.BASE64_CHARS.i... | AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left base64 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | static decode(base64: string): string {
if (!base64) {
return '';
}
base64 = base64.replace(/[^A-Za-z0-9+/=]/g, '');
let result = '';
let i = 0;
const len = base64.length;
while (i < len) {
const e1 = Base64Encoding.BASE64_CHARS.indexOf(base64.charAt(i++));
... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/Base64Encoding.ets#L49-L80 | 100829eb91606f4755edbda79b2e5df145efb1e4 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ar/ARCardService.ets | arkts | 触摸处理器接口 | export interface TouchHandler {
type: TouchType;
targetModel: string;
action: InteractionAction;
parameters?: Record<string, any>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TouchHandler AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left TouchType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left targetModel : AST#type_annota... | export interface TouchHandler {
type: TouchType;
targetModel: string;
action: InteractionAction;
parameters?: Record<string, any>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L198-L203 | 94d32d773cd42db26ffdbc48a641a6d7353c17f4 | github | |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets | arkts | getExpectDataType | Getter and setter for expectDataType | getExpectDataType(): http.HttpDataType | undefined {
return this.expectDataType;
} | AST#method_declaration#Left getExpectDataType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left http . HttpDataType AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST... | getExpectDataType(): http.HttpDataType | undefined {
return this.expectDataType;
} | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L47-L49 | 75585a5cea4081c441d7d1915d0c1c3ae872b133 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/PixelConversion/entry/src/main/ets/viewmodel/IntroductionItem.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export default interface | AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right | export default interface | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/PixelConversion/entry/src/main/ets/viewmodel/IntroductionItem.ets#L16-L16 | a41f4232672381c8ab00a870c7ff2998e2ee264d | gitee | |
lentozi/DailyPlan.git | 96ce0bec8f545511c51b577c4aa8327c2c5bb0c8 | entry/src/main/ets/databaseability/tables/TodoTable.ets | arkts | getRdbStore | 获取数据库操作变量 | getRdbStore(callback: Function = () => {}) {
this.todoTable.getRdbStore(callback);
} | AST#method_declaration#Left getRdbStore AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Le... | getRdbStore(callback: Function = () => {}) {
this.todoTable.getRdbStore(callback);
} | https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/tables/TodoTable.ets#L28-L30 | 36322e540cf0ebe460f75619603530f4889a5bf3 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.