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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/XAxis.ets | arkts | enum for the position of the x-labels relative to the chart | export enum XAxisPosition {
TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
} | AST#export_declaration#Left export AST#enum_declaration#Left enum XAxisPosition AST#enum_body#Left { AST#enum_member#Left TOP AST#enum_member#Right , AST#enum_member#Left BOTTOM AST#enum_member#Right , AST#enum_member#Left BOTH_SIDED AST#enum_member#Right , AST#enum_member#Left TOP_INSIDE AST#enum_member#Right , AST#en... | export enum XAxisPosition {
TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L220-L222 | 682f7c8818b09cc07f28923d37cb0ea9c1e05a7d | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets | arkts | pause | 暂停播放
@returns {void} | pause(): void {
this.avplayerModel.pause();
} | AST#method_declaration#Left pause AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AS... | pause(): void {
this.avplayerModel.pause();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L221-L223 | 4465692af4d658ccf3b4ccc907c69f60624c8a83 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/utils/Utils.ets | arkts | isVideo | 大概判断是否是视频片选择
@param types .ogm,.ogv,.mpg,.mp4,.mpeg,.m4v,.webm | static isVideo(types: string[]) {
return ArrayUtil.contain(types, ".mp4") && ArrayUtil.contain(types, ".m4v");
} | AST#method_declaration#Left static isVideo AST#parameter_list#Left ( AST#parameter#Left types : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS... | static isVideo(types: string[]) {
return ArrayUtil.contain(types, ".mp4") && ArrayUtil.contain(types, ".m4v");
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/utils/Utils.ets#L132-L134 | 9c4e9452971f9692ced8bbcb57c747a7d42d185d | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/common/RdbHelper.ets | arkts | getStartOfDay | ==================== UTILITY METHODS ====================
Get start of today (00:00:00) as timestamp | private getStartOfDay(): number {
const now = new Date();
now.setHours(0, 0, 0, 0);
return now.getTime();
} | AST#method_declaration#Left private getStartOfDay 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#variable_declaration#Left const AST#variable_declarator#Left n... | private getStartOfDay(): number {
const now = new Date();
now.setHours(0, 0, 0, 0);
return now.getTime();
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L609-L613 | f8246128c0366fa91989528fddf80510313572d5 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | eventbus/src/main/ets/EventBus.ets | arkts | once | 注册单次事件监听
@param eventName 事件名
@param handler 监听回调
@param isSticky 是否粘性 | static once(eventName: string, handler: Function, isSticky = false): void {
EventBusCore.getInstance().once(eventName, handler, isSticky);
} | AST#method_declaration#Left static once AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_t... | static once(eventName: string, handler: Function, isSticky = false): void {
EventBusCore.getInstance().once(eventName, handler, isSticky);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBus.ets#L24-L26 | a383ff5ef015cdb85ce8143a44e9628b98d38459 | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/ImageEditInterface.ets | arkts | 图片编辑报错 | export class ImageEditError extends Error {
code: number = -1
errMsg: string
constructor | AST#export_declaration#Left export AST#ERROR#Left class ImageEditError extends AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right { code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#u... | export class ImageEditError extends Error {
code: number = -1
errMsg: string
constructor | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L84-L88 | 4db9a2ad0f6f884890d2ec5800cd9fdfa232e957 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/GreetingsPage.ets | arkts | buildHeader | 构建页面头部 | @Builder
buildHeader() {
AppHeader({
title: this.isSelectionMode ? `已选择 ${this.selectedGreetings.size} 条` : '祝福语库',
showBack: !this.isSelectionMode,
showAction: true,
actionText: this.isSelectionMode ? '取消' : '选择',
onAction: () => {
if (this.isSelectionMode) {
this.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader 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 AppHeader ( AST#component_parameters#Left { AST#component_para... | @Builder
buildHeader() {
AppHeader({
title: this.isSelectionMode ? `已选择 ${this.selectedGreetings.size} 条` : '祝福语库',
showBack: !this.isSelectionMode,
showAction: true,
actionText: this.isSelectionMode ? '取消' : '选择',
onAction: () => {
if (this.isSelectionMode) {
this.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L190-L205 | 8fa57e528d9fbdca4f09575caf2d24bf6322473e | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | @description Get all task status
@return object[] Database query results | export const getAllTask = () => {
return new Promise<TaskInfo[]>((resolve) => {
TaskInfoApi.query(Const.GLOBAL_KEY, true, (res: TaskInfo[]) => {
if (res?.length === 0) {
Logger.warn('queryTaskList', 'has no data!!');
resolve(res ?? []);
}
resolve(res);
})
});
}
/**
* @des... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left getAllTask = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call... | export const getAllTask = () => {
return new Promise<TaskInfo[]>((resolve) => {
TaskInfoApi.query(Const.GLOBAL_KEY, true, (res: TaskInfo[]) => {
if (res?.length === 0) {
Logger.warn('queryTaskList', 'has no data!!');
resolve(res ?? []);
}
resolve(res);
})
});
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/TaskViewModel.ets#L34-L55 | f8bdd3a36c01190ac98e92acc8e414c7c2e133bd | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets | arkts | theme | 设置主题【【仅系统弹窗支持】】
@param theme
@returns | theme(theme?: Theme | CustomTheme) {
this.builderOptions.theme = theme;
return this;
} | AST#method_declaration#Left theme AST#parameter_list#Left ( AST#parameter#Left theme ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Theme AST#primary_type#Right | AST#primary_type#Left CustomTheme AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#par... | theme(theme?: Theme | CustomTheme) {
this.builderOptions.theme = theme;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseModalBuilderProxy.ets#L51-L54 | 68d93f93648459e57c06e6d164a8df07cfcc4e24 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/OrderRepository.ets | arkts | getOrderLogistics | 查询订单物流信息
@param orderId 订单 ID
@returns 物流详情 | async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> {
return this.networkDataSource.getOrderLogistics(orderId);
} | AST#method_declaration#Left async getOrderLogistics AST#parameter_list#Left ( AST#parameter#Left orderId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty... | async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> {
return this.networkDataSource.getOrderLogistics(orderId);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L100-L102 | dd568bf670736f236badd3627cb8648c3b3ff88c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/CustomerServiceRepository.ets | arkts | 构造函数
@param networkDataSource 客服网络数据源 | constructor(networkDataSource?: CustomerServiceNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new CustomerServiceNetworkDataSourceImpl();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left CustomerServiceNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#s... | constructor(networkDataSource?: CustomerServiceNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new CustomerServiceNetworkDataSourceImpl();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CustomerServiceRepository.ets#L18-L20 | 08aeb2ee9d6dae776e13952bb07776595ca5383a | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets | arkts | @Author csx
@DateTime 2024/3/18 10:39:03
@TODO ASN1Util SM2ASN.1工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto | export class ASN1Util {
static readonly BOOLEAN: string = "01";
static readonly INTEGER: string = "02";
static readonly BIT_STRING: string = "03";
static readonly OCTEN_STRING: string = "04";
static readonly NULL: string = "05";
static readonly REAL: string = "09";
static readonly ENUMERATED: string = "0a... | AST#export_declaration#Left export AST#class_declaration#Left class ASN1Util AST#class_body#Left { AST#property_declaration#Left static readonly BOOLEAN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "01" AST#expression#Right ; AST#property... | export class ASN1Util {
static readonly BOOLEAN: string = "01";
static readonly INTEGER: string = "02";
static readonly BIT_STRING: string = "03";
static readonly OCTEN_STRING: string = "04";
static readonly NULL: string = "05";
static readonly REAL: string = "09";
static readonly ENUMERATED: string = "0a... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L26-L36 | e6cd55e439a645e76bb1214f995c226801d6609e | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets | arkts | error | 打印ERROR级别日志
@param args | static error(...args: string[]): void {
if (LogUtil.showLog) {
hilog.error(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args)
}
} | AST#method_declaration#Left static error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A... | static error(...args: string[]): void {
if (LogUtil.showLog) {
hilog.error(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args)
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L84-L88 | dcd161b799ed9d2deec376b10181f4b889c7a76f | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Spacer.ets | arkts | SpaceVerticalXXLarge | @file 通用间距组件
@author Joker.X
创建一个超大垂直间距(32vp)
@returns {void} 无返回值 | @Builder
export function SpaceVerticalXXLarge(): void {
Blank().height($r("app.float.space_vertical_large_xx"));
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalXXLarge 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#ark... | @Builder
export function SpaceVerticalXXLarge(): void {
Blank().height($r("app.float.space_vertical_large_xx"));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L10-L13 | 3de6363db13a2587b211268fd6bd3836eac67f87 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 总览统计 | export interface OverviewStats {
totalContacts: number;
totalGreetings: number;
upcomingBirthdays: number;
thisMonthBirthdays: number;
thisWeekBirthdays: number;
todayBirthdays: number;
averageAge: number;
oldestPerson: string;
youngestPerson: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface OverviewStats AST#object_type#Left { AST#type_member#Left totalContacts : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalGreetings : AST#t... | export interface OverviewStats {
totalContacts: number;
totalGreetings: number;
upcomingBirthdays: number;
thisMonthBirthdays: number;
thisWeekBirthdays: number;
todayBirthdays: number;
averageAge: number;
oldestPerson: string;
youngestPerson: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L130-L140 | 74fee2248be0996a0d6aced6ba9cbf88bc210e39 | github | |
de8gemaker/AccountApp.git | b5156cd90ac02239b39fd0f91d32851acad8ba42 | entry/src/main/ets/views/stats.ets | arkts | statsMonthData | 按日期统计月账单数据 | async statsMonthData() {
const res = await AccountService.getAccountByMonth(this.time);
const { expenses, income, data } =
this.categoryType === CategoryType.DATE
? AccountService.statsConsumeByDate(res)
: AccountService.statsConsumeByType(res);
this.expenses = expenses;
this... | AST#method_declaration#Left async statsMonthData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left res = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expre... | async statsMonthData() {
const res = await AccountService.getAccountByMonth(this.time);
const { expenses, income, data } =
this.categoryType === CategoryType.DATE
? AccountService.statsConsumeByDate(res)
: AccountService.statsConsumeByType(res);
this.expenses = expenses;
this... | https://github.com/de8gemaker/AccountApp.git/blob/b5156cd90ac02239b39fd0f91d32851acad8ba42/entry/src/main/ets/views/stats.ets#L30-L39 | 28af573b1908f3f5ce4f66448740cc97ae47d022 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerInfoComp.ets | arkts | MusicPlayerInfoComp | 播放器歌曲信息组件,包括歌名、歌手、歌曲封面、歌词
实现步骤:
1.组件创建时,根据当前折叠屏状态和横竖屏状态初始化组件树上各组件属性
2.通过父组件监听屏幕折叠态变更事件,同时通过单项绑定通知到此组件的状态变量,修改组件树上各组件属性
3.通过媒体查询监听横竖屏变更,修改组件树上各组件属性
4.通过配置属性动画,动态变更各组件样式 | @Component
export struct MusicPlayerInfoComp {
// 父组件单向绑定的屏幕状态
@Prop @Watch('updateWithFoldStatus') curFoldStatus: display.FoldStatus;
// 当前页面的vm实例
@Consume('musicPlayerViewModel') @Watch('onViewModelChanged') viewModel: MusicPlayerViewModel;
// list控制器
private lyricsScrollerCtrl: Scroller = new Scroller();... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MusicPlayerInfoComp AST#component_body#Left { // 父组件单向绑定的屏幕状态 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'updateWithFoldStatus' AST#exp... | @Component
export struct MusicPlayerInfoComp {
@Prop @Watch('updateWithFoldStatus') curFoldStatus: display.FoldStatus;
@Consume('musicPlayerViewModel') @Watch('onViewModelChanged') viewModel: MusicPlayerViewModel;
private lyricsScrollerCtrl: Scroller = new Scroller();
@State lyricsCurIndex: number =... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerInfoComp.ets#L30-L81 | 1b4d30fd0530f4529ff341a5154440d370b4d2b8 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | china_area/src/main/ets/AreaHelper.ets | arkts | getAreaSync | 获取省市县的数据 | static getAreaSync(): Array<AreaEntity> {
if (AreaHelper.areaList == null || AreaHelper.areaList.length == 0) {
let jsonStr = AreaHelper.getAreaStrSync();
AreaHelper.areaList = JSON.parse(jsonStr) as Array<AreaEntity>;
}
return AreaHelper.areaList;
} | AST#method_declaration#Left static getAreaSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AreaEntity AST#primary_type#Right AST#type_annotation#Right > AST#type... | static getAreaSync(): Array<AreaEntity> {
if (AreaHelper.areaList == null || AreaHelper.areaList.length == 0) {
let jsonStr = AreaHelper.getAreaStrSync();
AreaHelper.areaList = JSON.parse(jsonStr) as Array<AreaEntity>;
}
return AreaHelper.areaList;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/china_area/src/main/ets/AreaHelper.ets#L53-L59 | b24229f1f5573d2243b400ca9b0b8f5443cfd107 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildGreetingCard | 构建祝福语卡片 | @Builder
buildGreetingCard(greeting: GreetingItem) {
Column({ space: 8 }) {
Row() {
Text(greeting.category)
.fontSize(10)
.fontColor('#4ECDC4')
.backgroundColor('#f0f9ff')
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
.borderRadius(12)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingCard AST#parameter_list#Left ( AST#parameter#Left greeting : AST#type_annotation#Left AST#primary_type#Left GreetingItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_f... | @Builder
buildGreetingCard(greeting: GreetingItem) {
Column({ space: 8 }) {
Row() {
Text(greeting.category)
.fontSize(10)
.fontColor('#4ECDC4')
.backgroundColor('#f0f9ff')
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
.borderRadius(12)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1431-L1531 | 48f42101c365a8e50962f1ad7923f9edfdd15a3a | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | daysTo | 计算从指定日期到另一个日期的天数差(可以是负数,表示先后顺序)
@param from 起始日期
@param to 结束日期
@returns 天数差(整数,可能为负数) | static daysTo(from: Date, to: Date): number {
// 只保留年月日
const start = new Date(from.getFullYear(), from.getMonth(), from.getDate());
const end = new Date(to.getFullYear(), to.getMonth(), to.getDate());
const msPerDay = 24 * 60 * 60 * 1000;
return Math.floor((end.getTime() - start.getTime()) / msPer... | AST#method_declaration#Left static daysTo AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#... | static daysTo(from: Date, to: Date): number {
const start = new Date(from.getFullYear(), from.getMonth(), from.getDate());
const end = new Date(to.getFullYear(), to.getMonth(), to.getDate());
const msPerDay = 24 * 60 * 60 * 1000;
return Math.floor((end.getTime() - start.getTime()) / msPerDay);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L12-L19 | 30c568cf9f47f3d2c5372e4b1665877fcf179e34 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | formatLunarDate | 格式化农历日期
@param year 农历年份
@param month 农历月份
@param day 农历日期
@param isLeapMonth 是否闰月
@param format 格式(short | long)
@returns 格式化后的农历日期字符串 | formatLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false, format: 'short' | 'long' = 'short'): string {
return LunarUtils.formatLunarDate({
year,
month,
day,
leapMonth: isLeapMonth
} as LunarDate, format);
} | AST#method_declaration#Left formatLunarDate AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | formatLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false, format: 'short' | 'long' = 'short'): string {
return LunarUtils.formatLunarDate({
year,
month,
day,
leapMonth: isLeapMonth
} as LunarDate, format);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L551-L558 | 56ce8f7628c6a29053d20af87d7241fceb338122 | github |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/NotificationManager.ets | arkts | requestPermission | 请求通知权限 | async requestPermission(): Promise<boolean> {
try {
console.info('🔔 Requesting notification permission...')
await notificationManager.requestEnableNotification()
console.info('✅ Notification permission granted!')
return true
} catch (err) {
const error = err as BusinessError
... | AST#method_declaration#Left async requestPermission AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#... | async requestPermission(): Promise<boolean> {
try {
console.info('🔔 Requesting notification permission...')
await notificationManager.requestEnableNotification()
console.info('✅ Notification permission granted!')
return true
} catch (err) {
const error = err as BusinessError
... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L22-L33 | d8baa8ce7db4177b77ccc792a5e099c8d852a523 | github |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | registWithLogin | 注册并登录
@param username wanandroid账号
@param password 密码
@param repassword 二次密码 | async registWithLogin(username: string, password: string, repassword: string) {
try {
const result = await WanHttpClient.regist(username, password, repassword);
if (result.response.errorCode === 0) {
await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password);
Ev... | AST#method_declaration#Left async registWithLogin AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : AST#type_annotation#Left AST#primary_type#Left string AST#p... | async registWithLogin(username: string, password: string, repassword: string) {
try {
const result = await WanHttpClient.regist(username, password, repassword);
if (result.response.errorCode === 0) {
await this.updateLoginInfo(result.response.data, result.cookies.join(';'), password);
Ev... | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L124-L139 | 8e0270531cdbd561c160c664e970661a8a294bb6 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/PodcastService.ets | arkts | httpRequest | 发送HTTP请求 | private async httpRequest(url: string): Promise<string> {
return new Promise((resolve, reject) => {
const httpRequest = http.createHttp();
httpRequest.request(url, {
method: http.RequestMethod.GET,
connectTimeout: Constants.HTTP_TIMEOUT,
readTimeout: Constants.HTTP_TIMEOUT... | AST#method_declaration#Left private async httpRequest AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type... | private async httpRequest(url: string): Promise<string> {
return new Promise((resolve, reject) => {
const httpRequest = http.createHttp();
httpRequest.request(url, {
method: http.RequestMethod.GET,
connectTimeout: Constants.HTTP_TIMEOUT,
readTimeout: Constants.HTTP_TIMEOUT... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L183-L200 | af42080a2973daa32fe81e3ef97ec97dd524f8e5 | github |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/pages/CategoryDetailPage.ets | arkts | dispatchScrollOffset | 处理滚动事件 | private dispatchScrollOffset() {
const opacity = this.scrollOffset / 200;
// 注意这里的边界场景
this.alpha = opacity > 1 ? 1 : opacity < 0 ? 0 : opacity;
} | AST#method_declaration#Left private dispatchScrollOffset AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left opacity = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#... | private dispatchScrollOffset() {
const opacity = this.scrollOffset / 200;
this.alpha = opacity > 1 ? 1 : opacity < 0 ? 0 : opacity;
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/pages/CategoryDetailPage.ets#L213-L217 | e95c7fa1d04be13f79a1829984305113e01a0635 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/Comment.ets | arkts | @file 商品评价
@author Joker.X | export class Comment {
/**
* ID
*/
id: number = 0;
/**
* 用户ID
*/
userId: number = 0;
/**
* 商品ID
*/
goodsId: number = 0;
/**
* 订单ID
*/
orderId: number = 0;
/**
* 内容
*/
content: string = "";
/**
* 星数
*/
starCount: number = 5;
/**
* 图片
*/
pics?: string[... | AST#export_declaration#Left export AST#class_declaration#Left class Comment AST#class_body#Left { /**
* ID
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declar... | export class Comment {
id: number = 0;
userId: number = 0;
goodsId: number = 0;
orderId: number = 0;
content: string = "";
starCount: number = 5;
pics?: string[] | null = null;
nickName?: string | null = null;
avatarUrl?: string | null = null;
createTime?: string | null... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Comment.ets#L5-L67 | 8c1ab60918922f631560485d31493782a9c1cfe9 | github | |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/common/widget/VideoPlaySlider.ets | arkts | iconOnclick | icon onclick callback | iconOnclick() {
if (this.isPlay === true) {
this.controller.pause()
this.isPlay = false;
this.isOpacity = false;
return;
}
if (this.flag === true) {
this.controller.start();
this.isPlay = true;
this.isOpacity = true;
} else {
this.isLoading = true;
/... | AST#method_declaration#Left iconOnclick AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right... | iconOnclick() {
if (this.isPlay === true) {
this.controller.pause()
this.isPlay = false;
this.isOpacity = false;
return;
}
if (this.flag === true) {
this.controller.start();
this.isPlay = true;
this.isOpacity = true;
} else {
this.isLoading = true;
... | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/widget/VideoPlaySlider.ets#L63-L96 | d27f7cfee6818ce5bc3812a063d9fb43e7f4d79a | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | Q2/DxinTranslate/entry/src/main/ets/model/Data.ets | arkts | 语种选择的类型 | export class Language {
lang: string
chinese: string
// 构造函数
constructor | AST#export_declaration#Left export AST#ERROR#Left class Language { lang : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ch in ese AST#ERROR#Right : string AST#ERROR#Right // 构造函数 AST#variable_declaration#Left const AST#variable_declarator#Left ru... | export class Language {
lang: string
chinese: string
constructor | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q2/DxinTranslate/entry/src/main/ets/model/Data.ets#L2-L6 | 3e4fa82e15740e074af91f35f46b085317649e5d | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/transform/GrayScaleTransformation.ets | arkts | GrayScaleTransformation | 图片变换:灰化效果 | @Sendable
export class GrayScaleTransformation extends PixelMapTransformation {
constructor() {
super();
}
async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> {
let headFilter = effectKit.createEffect(toTransform);
if (headFilter != null) {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class GrayScaleTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor A... | @Sendable
export class GrayScaleTransformation extends PixelMapTransformation {
constructor() {
super();
}
async transform(context: Context, toTransform: PixelMap, width: number, height: number): Promise<PixelMap> {
let headFilter = effectKit.createEffect(toTransform);
if (headFilter != null) {
... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/GrayScaleTransformation.ets#L21-L34 | e5fe36d21d491e681628735742c0c1fc9e8d3bbc | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/model/Const.ets | arkts | @author: HZWei
@date: 2024/9/22
@desc: | export enum ErrorCode {
PARAMETER_ERROR = 401,
INTERNAL_ERROR = 100001,
NOT_REGISTERED = 100005,
NOT_FOUND = 100006,
INTERCEPTED = 301
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ErrorCode AST#enum_body#Left { AST#enum_member#Left PARAMETER_ERROR = AST#expression#Left 401 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left INTERNAL_ERROR = AST#expression#Left 100001 AST#expression#Right AST#enum_member#Right , AST#e... | export enum ErrorCode {
PARAMETER_ERROR = 401,
INTERNAL_ERROR = 100001,
NOT_REGISTERED = 100005,
NOT_FOUND = 100006,
INTERCEPTED = 301
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/model/Const.ets#L7-L13 | f7594240126b803798cb2f4eb2225fb0c2b01b7b | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets | arkts | compressedImage | 图片压缩
@param sourcePixelMap:原始待压缩图片的PixelMap对象
@param maxCompressedImageSize:指定图片的压缩目标大小,单位kb | async compressedImage(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number): Promise<void> {
// 判断是优先压缩质量还是优先压缩尺寸
if (this.isQualityPriority) {
// 优先压缩质量
await this.qualityPriorityCompress(sourcePixelMap, maxCompressedImageSize);
} else {
// 优先压缩尺寸
await this.scalePriorityC... | AST#method_declaration#Left async compressedImage AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxCo... | async compressedImage(sourcePixelMap: image.PixelMap, maxCompressedImageSize: number): Promise<void> {
if (this.isQualityPriority) {
await this.qualityPriorityCompress(sourcePixelMap, maxCompressedImageSize);
} else {
await this.scalePriorityCompress(sourcePixelMap, maxCompressedI... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L235-L244 | 43570315b73630c0782de3db81038742a5953a78 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets | arkts | emit | 触发事件
@param event 事件名称
@param data 事件数据(泛型T,默认为void) | static emit<T = void>(event: string, data?: T): void {
// 处理常规监听器
const handlers = SimpleEventBus.listeners.get(event);
handlers?.forEach(handler => {
try {
handler(data);
} catch (err) {
console.error(`[事件处理错误] ${event}:`, err);
}
});
// 处理一次性监听器(执行后自动移除)
cons... | AST#method_declaration#Left static emit AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotatio... | static emit<T = void>(event: string, data?: T): void {
const handlers = SimpleEventBus.listeners.get(event);
handlers?.forEach(handler => {
try {
handler(data);
} catch (err) {
console.error(`[事件处理错误] ${event}:`, err);
}
});
const onceHandlers = SimpleEventBu... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets#L16-L44 | c0c73f735d4f2acbdb13a3e8fe7099f6c73d3dd1 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | isNRSupported | 判断当前设备是否支持NR(New Radio)。也就是5G。
@param slotId 卡槽ID,不传默认主卡。 | static isNRSupported(slotId?: number): boolean {
if (slotId) {
return radio.isNRSupported(slotId);
}
return radio.isNRSupported();
} | AST#method_declaration#Left static isNRSupported AST#parameter_list#Left ( AST#parameter#Left slotId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#prim... | static isNRSupported(slotId?: number): boolean {
if (slotId) {
return radio.isNRSupported(slotId);
}
return radio.isNRSupported();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L309-L314 | 433da3919618e213bdf8a69e57728635962c8cac | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/managers/StorageManager.ets | arkts | getSecureItem | 获取安全存储的敏感数据
@param key 键
@param defaultValue 默认值
@returns 操作结果 | static async getSecureItem<T>(key: string, defaultValue?: T): Promise<StorageResult<T>> {
return this.getItem(key, defaultValue, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true });
} | AST#method_declaration#Left static async getSecureItem AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#p... | static async getSecureItem<T>(key: string, defaultValue?: T): Promise<StorageResult<T>> {
return this.getItem(key, defaultValue, { name: AppConstants.SECURE_STORAGE_NAME, encrypted: true });
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L273-L275 | f0df46815d125a883508bfed453003602fb13d9b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/entryability/EntryAbility.ets | arkts | onDestroy | Ability销毁时的回调 | onDestroy(): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onDestroy');
// 清理资源
this.cleanupServices();
} | AST#method_declaration#Left onDestroy 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#Lef... | onDestroy(): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onDestroy');
this.cleanupServices();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L33-L38 | 52fa0fe7b30b05fc28d05277082a8d0fbbabf3ae | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets | arkts | startAlipayPayment | 发起支付宝支付
@returns {void} 无返回值 | startAlipayPayment(): void {
if (!this.orderId) {
return;
}
const params: AlipayPayParams = { orderId: this.orderId };
RequestHelper.repository<string>(this.orderRepository.alipayAppPay(params))
.execute()
.then((payInfo: string): void => {
this.startAlipaySdk(payInfo);
}... | AST#method_declaration#Left startAlipayPayment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Le... | startAlipayPayment(): void {
if (!this.orderId) {
return;
}
const params: AlipayPayParams = { orderId: this.orderId };
RequestHelper.repository<string>(this.orderRepository.alipayAppPay(params))
.execute()
.then((payInfo: string): void => {
this.startAlipaySdk(payInfo);
}... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets#L59-L69 | ee2368a55fe6e7ac387c985157da25200a67f05b | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets | arkts | clear | Clears the chart from all data (sets it to null) and refreshes it (by
calling invalidate()). | public clear() {
this.mData = null;
this.mOffsetsCalculated = false;
this.mIndicesToHighlight = null;
this.mChartTouchListener.setLastHighlighted(null);
this.invalidate();
} | AST#method_declaration#Left public clear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right = A... | public clear() {
this.mData = null;
this.mOffsetsCalculated = false;
this.mIndicesToHighlight = null;
this.mChartTouchListener.setLastHighlighted(null);
this.invalidate();
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L240-L246 | 97a5e72f56daffe045cc0a3e055b2d71f1c7b19f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | getMainUIContext | 获取MainWindow的UIContext
@returns | static getMainUIContext(): UIContext | undefined {
if (DialogHelper.mainUIContext) {
return DialogHelper.mainUIContext;
}
try {
const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext();
if (uiContext) {
DialogHelper.mainUIContext = uiConte... | AST#method_declaration#Left static getMainUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UIContext AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block... | static getMainUIContext(): UIContext | undefined {
if (DialogHelper.mainUIContext) {
return DialogHelper.mainUIContext;
}
try {
const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext();
if (uiContext) {
DialogHelper.mainUIContext = uiConte... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L91-L104 | a6cea2cd83c0f70658aced7e21f7cc30627243a7 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/src/main/ets/component/network/BaseNetWorkView.ets | arkts | 渲染网络请求状态视图
@returns {void} 无返回值 | build() {
Stack() {
Column() {
if (this.loadingBuilder) {
this.loadingBuilder();
} else {
this.buildDefaultLoading();
}
}
.opacity(this.uiState === BaseNetWorkUiState.LOADING ? 1 : 0)
.animation({ duration: 200, curve: Curve.EaseInOut });
Co... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_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_cont... | build() {
Stack() {
Column() {
if (this.loadingBuilder) {
this.loadingBuilder();
} else {
this.buildDefaultLoading();
}
}
.opacity(this.uiState === BaseNetWorkUiState.LOADING ? 1 : 0)
.animation({ duration: 200, curve: Curve.EaseInOut });
Co... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/network/BaseNetWorkView.ets#L62-L92 | 6abb22b39a6e7fa9b3b81f64015498694886c230 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | getCacheDirPath | 获取缓存目录下的文件夹路径或文件路径。
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns | static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir; //根目录
if (Helper.isNotEmpty(dirPath)) {
if (Helper.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。
filePath = ... | AST#method_declaration#Left static getCacheDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_anno... | static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().cacheDir : getContext().getApplicationContext().cacheDir;
if (Helper.isNotEmpty(dirPath)) {
if (Helper.hasDirPath(dirPath)) {
filePath = dirPath;
} else ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L193-L209 | 26935a0793cc75260d89482f2f642a227f98306c | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/BusinessSample/entry/src/main/ets/common/bean/TabItemData.ets | arkts | Tab item data entity. | export class TabItemData {
/**
* Tab index.
*/
index: number;
/**
* Tab original icon.
*/
imageOriginal: Resource;
/**
* Tab activated icon.
*/
imageActivated: Resource;
/**
* Tab title.
*/
title: Resource;
} | AST#export_declaration#Left export AST#class_declaration#Left class TabItemData AST#class_body#Left { /**
* Tab index.
*/ AST#property_declaration#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Tab origi... | export class TabItemData {
index: number;
imageOriginal: Resource;
imageActivated: Resource;
title: Resource;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/common/bean/TabItemData.ets#L4-L24 | c58ff7a0430aacff8bc3ac1981f7f86d42c89098 | gitee | |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | src/main/ets/pages/WeeklyTaskPage.ets | arkts | buildEmptyState | 构建空状态 | @Builder
buildEmptyState() {
Column() {
Image($r('app.media.ic_empty_tasks'))
.width(120)
.height(120)
.margin({ bottom: 16 })
Text('暂无任务安排')
.fontSize(18)
.fontColor('#999999')
.margin({ bottom: 8 })
Text('点击上方"添加任务"按钮开始安排您的周任务')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyState 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
buildEmptyState() {
Column() {
Image($r('app.media.ic_empty_tasks'))
.width(120)
.height(120)
.margin({ bottom: 16 })
Text('暂无任务安排')
.fontSize(18)
.fontColor('#999999')
.margin({ bottom: 8 })
Text('点击上方"添加任务"按钮开始安排您的周任务')
... | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L101-L123 | 4ac6881b4ef6d640891b90febb3ead681762aa5b | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取动态评论
@param id 动态ID
@param page 页码
@param size 每页大小
@returns 评论列表 | export function getPostComments(id: number, page: number, size: number): Promise<Comment[]> {
try {
console.info(`获取动态评论, id: ${id}, page: ${page}, size: ${size}`);
const params: RequestData = {
page,
size
};
// 确保路径以"/"开头,修复URL结构
return request<ApiResponse<Comment[]>>(Reques... | AST#export_declaration#Left export AST#function_declaration#Left function getPostComments AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left page : AST#type_annotation#Left AST#... | export function getPostComments(id: number, page: number, size: number): Promise<Comment[]> {
try {
console.info(`获取动态评论, id: ${id}, page: ${page}, size: ${size}`);
const params: RequestData = {
page,
size
};
return request<ApiResponse<Comment[]>>(RequestMethod.GET, `/posts/... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L906-L934 | d14ffb0928fc8a776a0d682ced7b76749bd4f3d0 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets | arkts | SetCodeCallBack | 设置有序公共事件的结果代码回调 | function SetCodeCallBack() {
} | AST#function_declaration#Left function SetCodeCallBack AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#function_declaration#Right | function SetCodeCallBack() {
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L356-L357 | 54589185007d2ce6e021a61866e2f68695d37514 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarChartModel.ets | arkts | setDrawValueAboveBar | If set to true, all values are drawn above their bars, instead of below their top.
@param enabled | public setDrawValueAboveBar(enabled: boolean): void {
this.mDrawValueAboveBar = enabled;
} | AST#method_declaration#Left public setDrawValueAboveBar AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#... | public setDrawValueAboveBar(enabled: boolean): void {
this.mDrawValueAboveBar = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L203-L205 | 1dbeba12c63db2be7910bd6825c3f8bf30da1c08 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets | arkts | exchangeIcon | 点击即可交换的图标 | @Builder
exchangeIcon() {
Image($r('app.media.address_exchange_airplane'))
.size({
height: $r('app.integer.address_exchange_airplane_size'),
width: $r('app.integer.address_exchange_airplane_size')
})
Image($r('app.media.address_exchange_recycle'))
.id('translate_image')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right exchangeIcon 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 Image ( AST#expression#Left AST#resource_expression#Left $r (... | @Builder
exchangeIcon() {
Image($r('app.media.address_exchange_airplane'))
.size({
height: $r('app.integer.address_exchange_airplane_size'),
width: $r('app.integer.address_exchange_airplane_size')
})
Image($r('app.media.address_exchange_recycle'))
.id('translate_image')
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressexchange/src/main/ets/view/AddressExchangeView.ets#L171-L185 | 762feaa0b80ce6a6aa31cbb40124ac317120d388 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets | arkts | toolTouch | 悬浮球样式
@param {ToolTouchInterface} $$ - 悬浮球入参 | @Builder
toolTouch($$: ToolTouchInterface) {
Button() {
Button()
.height(CommonConstants.EIGHTY_PERCENT)
.width(CommonConstants.EIGHTY_PERCENT)
.backgroundColor($$.isDisable ? Color.Red : Color.Gray)
.opacity(0.5)
}
.height(CommonConstants.FULL_PERCENT)
.width(Com... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right toolTouch AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left ToolTouchInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_... | @Builder
toolTouch($$: ToolTouchInterface) {
Button() {
Button()
.height(CommonConstants.EIGHTY_PERCENT)
.width(CommonConstants.EIGHTY_PERCENT)
.backgroundColor($$.isDisable ? Color.Red : Color.Gray)
.opacity(0.5)
}
.height(CommonConstants.FULL_PERCENT)
.width(Com... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/pages/ToolBoxView.ets#L222-L235 | 8ef997f839c36740c271c0fd2504c5832052d9f5 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets | arkts | getLabelRotationAngle | returns the angle for drawing the X axis labels (in degrees) | public getLabelRotationAngle(): number {
return this.mLabelRotationAngle;
} | AST#method_declaration#Left public getLabelRotationAngle 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#me... | public getLabelRotationAngle(): number {
return this.mLabelRotationAngle;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L93-L95 | af06720d194da0893de9a8f29e72b0bc95db9725 | gitee |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets | arkts | notifyDataReload | 通知LazyForEach组件需要重载所有子组件 | notifyDataReload(): void {
Logger.debug('notifyDataReload');
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
} | AST#method_declaration#Left notifyDataReload 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#express... | notifyDataReload(): void {
Logger.debug('notifyDataReload');
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
} | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets#L229-L234 | a196ebfdf4e7158b816fbd708f92ab8e7015e326 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/analytics/AnalyticsPage.ets | arkts | buildUsageTab | 构建使用情况标签页 | @Builder
buildUsageTab(usage: UsageStats) {
Scroll() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
// 使用时长统计
this.buildStatsCard('使用时长', [
{ label: '今日使用', value: this.formatDuration(usage.dailyActiveTime), icon: $r('app.media.ic_today') },
{ label: '本周使用', value: th... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUsageTab AST#parameter_list#Left ( AST#parameter#Left usage : AST#type_annotation#Left AST#primary_type#Left UsageStats AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_b... | @Builder
buildUsageTab(usage: UsageStats) {
Scroll() {
Column({ space: UIConstants.DEFAULT_PADDING }) {
this.buildStatsCard('使用时长', [
{ label: '今日使用', value: this.formatDuration(usage.dailyActiveTime), icon: $r('app.media.ic_today') },
{ label: '本周使用', value: this.format... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L507-L572 | 342e4e73a8a81eb2ffe4c5bb083c9294a74d7060 | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnife.ets | arkts | preload | 预加载
@param loadSrc 图片地址url
@returns 图片请求request | preload(loadSrc:string | ImageKnifeOption):ImageKnifeRequest{
let imageKnifeOption = new ImageKnifeOption()
if (typeof loadSrc == 'string') {
imageKnifeOption.loadSrc = loadSrc
} else {
imageKnifeOption = loadSrc;
}
let request = new ImageKnifeRequest(
imageKnifeOption,
image... | AST#method_declaration#Left preload AST#parameter_list#Left ( AST#parameter#Left loadSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ImageKnifeOption AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right )... | preload(loadSrc:string | ImageKnifeOption):ImageKnifeRequest{
let imageKnifeOption = new ImageKnifeOption()
if (typeof loadSrc == 'string') {
imageKnifeOption.loadSrc = loadSrc
} else {
imageKnifeOption = loadSrc;
}
let request = new ImageKnifeRequest(
imageKnifeOption,
image... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L154-L174 | 3b5edf637222e50f302cacd19c7cf7de70497749 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosConfig.ets | arkts | Transforming the Auth into a Sendable interface | export interface IAuth extends lang.ISendable {
username: string;
password: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IAuth AST#extends_clause#Left extends AST#extends_clause#Right AST#ERROR#Left AST#qualified_type#Left lang . ISendable AST#qualified_type#Right AST#ERROR#Right AST#object_type#Left { AST#type_member#Left username : AST#type_annotation#Left AST#... | export interface IAuth extends lang.ISendable {
username: string;
password: string;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosConfig.ets#L35-L38 | fb9c888ec64d53d05d3c00a17342bd6045806e9a | gitee | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/LogService.ets | arkts | initialize | 初始化日志服务 | async initialize(context: common.UIAbilityContext): Promise<void> {
if (this.isInitialized) {
console.info('[LogService] 已经初始化,跳过');
return;
}
console.info('[LogService] ========== 开始初始化日志服务 ==========');
try {
// 获取应用文件目录
const filesDir = context.filesDir;
this.logDir = ... | AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | async initialize(context: common.UIAbilityContext): Promise<void> {
if (this.isInitialized) {
console.info('[LogService] 已经初始化,跳过');
return;
}
console.info('[LogService] ========== 开始初始化日志服务 ==========');
try {
const filesDir = context.filesDir;
this.logDir = `${filesDir... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/LogService.ets#L48-L112 | 475b9c5786d8e61878ff59343797c9aab9efdd30 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets | arkts | notifyDataChange | 通知控制器数据变化
@param index 数组索引 | 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-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolinkagelist/src/main/ets/model/NewsListDataSource.ets#L105-L109 | baec4dc77de26a148f2dfad7a0f77520b2d8f949 | gitee |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/components/MusicMyComponent.ets | arkts | useAddDirectory | @description: 跳转到歌单列表页
@date: 2024-07-16 22:37
@author wuwenqiang | useAddDirectory(){
this.favoriteDialogController = new CustomDialogController({
customStyle: true,
builder: BottomDialogComponent({
dialogHeight: '80%',
builder: this.favoriteBuilder.bind(this)
}),
alignment: DialogAlignment.Bottom,
})
this.favoriteDialogController.op... | AST#method_declaration#Left useAddDirectory AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . favoriteDialogController AST#membe... | useAddDirectory(){
this.favoriteDialogController = new CustomDialogController({
customStyle: true,
builder: BottomDialogComponent({
dialogHeight: '80%',
builder: this.favoriteBuilder.bind(this)
}),
alignment: DialogAlignment.Bottom,
})
this.favoriteDialogController.op... | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicMyComponent.ets#L63-L73 | eb65b24c0164c86d3d4a9a7184a445936b63f9fd | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets | arkts | getAppListAsync | Get the list of apps displayed on the desktop (private function).
@return {array} bundleInfoList, excluding system applications | async getAppListAsync(): Promise<AppItemInfo[]> {
let allAbilityList: AppItemInfo[] | undefined = await this.mLauncherAbilityManager?.getLauncherAbilityList();
Logger.info(TAG, `getAppListAsync allAbilityList length: ${allAbilityList?.length}`);
let launcherAbilityList: AppItemInfo[] = [];
for (let i = ... | AST#method_declaration#Left async getAppListAsync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AppItemInfo [ ] AST#array_type#Right AST#prim... | async getAppListAsync(): Promise<AppItemInfo[]> {
let allAbilityList: AppItemInfo[] | undefined = await this.mLauncherAbilityManager?.getLauncherAbilityList();
Logger.info(TAG, `getAppListAsync allAbilityList length: ${allAbilityList?.length}`);
let launcherAbilityList: AppItemInfo[] = [];
for (let i = ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L213-L225 | 17b1b1bc66a8e43f1c58db924dde36cf215616a0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/refreshtimeline/src/main/ets/view/RefreshTimeLine.ets | arkts | getTimeLineMode | 时间轴模块 | @Builder
getTimeLineMode(time: string, text: string) {
Row() {
Column() {
// 时间轴
Column()
.width($r('app.integer.refreshtimeline_width_and_height_zero'))
.height($r('app.integer.refreshtimeline_width_and_height_one_hundred_and_forty'))
.border({
widt... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getTimeLineMode AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#type_annotation#Left... | @Builder
getTimeLineMode(time: string, text: string) {
Row() {
Column() {
Column()
.width($r('app.integer.refreshtimeline_width_and_height_zero'))
.height($r('app.integer.refreshtimeline_width_and_height_one_hundred_and_forty'))
.border({
width: { l... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/refreshtimeline/src/main/ets/view/RefreshTimeLine.ets#L73-L132 | c11ababbbd3a4eebd7d66ca8daaa61a06ad0c104 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/empty/EmptyData.ets | arkts | 构建数据缺省页视图
@returns {void} 无返回值 | build(): void {
Empty({
description: $r("app.string.empty_data"),
imageRes: $r("app.media.ic_empty_data")
});
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left Empty ( AST#component_parameters#Left { AST#component_parameter#Left description : AST#expression#Left AST#resource_expressi... | build(): void {
Empty({
description: $r("app.string.empty_data"),
imageRes: $r("app.media.ic_empty_data")
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/empty/EmptyData.ets#L13-L18 | e6af8d25882bec01ef0dd0ecb1a2f17f16e362d6 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/Preferences/entry/src/main/ets/view/TextItemComponent.ets | arkts | TextItemComponent | Text item component. | @Component
export default struct TextItemComponent {
private textResource: Resource = $r('app.string.empty');
private placeholderResource: Resource = $r('app.string.empty');
private marginBottom: string = '';
private marginTop: string = '';
private textInputType: InputType = InputType.Normal;
private textFl... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct TextItemComponent AST#component_body#Left { AST#property_declaration#Left private textResource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#e... | @Component
export default struct TextItemComponent {
private textResource: Resource = $r('app.string.empty');
private placeholderResource: Resource = $r('app.string.empty');
private marginBottom: string = '';
private marginTop: string = '';
private textInputType: InputType = InputType.Normal;
private textFl... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/view/TextItemComponent.ets#L23-L82 | c6e1d2a316f0609a9f6c918f1c4f6b460546b10b | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogHub.ets | arkts | getDatePicker | 日期选择 弹窗
@returns | static getDatePicker(uiContext?: UIContext): DatePickerBuilderProxy {
return new DatePickerBuilderProxy(uiContext)
} | AST#method_declaration#Left static getDatePicker AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DatePicker... | static getDatePicker(uiContext?: UIContext): DatePickerBuilderProxy {
return new DatePickerBuilderProxy(uiContext)
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L157-L159 | de35e6779d91c01562315e03af110e72cc42307d | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | View that represents a pie chart. Draws cake like slices. | @ObservedV2
export default class PieChartModel extends PieRadarChartBase<PieData> {
/**
* rect object that represents the bounds of the piechart, needed for
* drawing the circle
*/
private mCircleBox: MyRect = new MyRect();
/**
* flag indicating if entry labels should be drawn or not
*/
private m... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class PieChartModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left PieRadarChartBase AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ... | @ObservedV2
export default class PieChartModel extends PieRadarChartBase<PieData> {
private mCircleBox: MyRect = new MyRect();
private mDrawEntryLabels: boolean = true;
private mDrawAngles: number[] = new Array<number>(1);
private mAbsoluteAngles: number[] = new Array<number>(1);
private mDrawH... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L35-L859 | 6ae7955989d6b837f8f266d1f1166a9988425692 | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getDaysDiff | 计算两个日期之间的天数差
@param date1 日期1
@param date2 日期2
@returns 天数差 | static getDaysDiff(date1: Date, date2: Date): number {
const timeDiff = Math.abs(date2.getTime() - date1.getTime());
return Math.ceil(timeDiff / (1000 * 3600 * 24));
} | AST#method_declaration#Left static getDaysDiff AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date2 : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#R... | static getDaysDiff(date1: Date, date2: Date): number {
const timeDiff = Math.abs(date2.getTime() - date1.getTime());
return Math.ceil(timeDiff / (1000 * 3600 * 24));
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L67-L70 | 5d4ab953fdf83d4a79d771b3c7e654c0f34d7dfa | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets | arkts | HalfModalWindowComponent | 场景描述:
登录方式有两种,验证码登录和账户,需要在一个全屏模态窗口CaptureLogin中切换,使用if进行条件渲染
1、通过配置NavDestinationMode类型为DIALOG,实现半模态的背景为透明
2、通过bindSheet属性为主页无样式的Text绑定半模态页面,再通过bindContentCover属性为主页无样式的Text绑定全屏模态页面
3、在半模态页面中的验证码登录按钮点击时打开全屏模态转场,并将对应的组件入场动效置为空,此时进场只保留全屏模态入场动效
4、通过点击第二步中的按钮跳转到全屏模态组件(CaptureLogin),并通过通过isDefaultLogin控制两种登录组件的条件渲染:true(手机验... | @Component
export struct HalfModalWindowComponent {
// 是否显示半屏模态页面
@State isPresent: boolean = false;
// 半模态高度
@State sheetHeight: number = 500;
// 是否显示控制条
@State showDragBar: boolean = true;
// 判断是否同意协议
@State isConfirmed: boolean = false;
// 控制全模态的展示
@State isPresentInLoginView: boolean = false;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HalfModalWindowComponent AST#ERROR#Left { // 是否显示半屏模态页面 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isPresent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#... | @Component
export struct HalfModalWindowComponent {
@State isPresent: boolean = false;
@State sheetHeight: number = 500;
@State showDragBar: boolean = true;
@State isConfirmed: boolean = false;
@State isPresentInLoginView: boolean = false;
@State op: number = 0.5;
@State isShowTransit... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multimodaltransion/src/main/ets/view/HalfModalWindow.ets#L41-L226 | c12c49cc489d5b808f0cba32bd319a0c12553c98 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets | arkts | setAVPlaybackState | 设置AVSession实例状态
@returns {void} | setAVPlaybackState(): void {
logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState));
// TODO:知识点:设置AVSession当前状态
this.session?.setAVPlaybackState(this.curState, (err) => {
if (err) {
console.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`);... | AST#method_declaration#Left setAVPlaybackState 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#expre... | setAVPlaybackState(): void {
logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState));
this.session?.setAVPlaybackState(this.curState, (err) => {
if (err) {
console.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`);
} else {
con... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L263-L273 | 353745c55d471a3b728888310291c65ea6ba02b5 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/InterpolationSearch.ets | arkts | searchOptimized | 优化的插值查找,添加边界检查
@param arr 已排序的数组
@param target 目标值
@returns 目标值在数组中的索引,如果不存在则返回-1 | public static searchOptimized(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
// 快速检查边界情况
if (target < arr[left] || target > arr[right]) {
return -1;
}
while (left <= right) {
// 防止除零错误
... | AST#method_declaration#Left public static searchOptimized AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_anno... | public static searchOptimized(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
if (target < arr[left] || target > arr[right]) {
return -1;
}
while (left <= right) {
if (arr[right] ... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/InterpolationSearch.ets#L51-L93 | f2c410db6f594744b175af6cdf199c69bc78e7b9 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/ScatterDataSet.ets | arkts | setScatterShape | Sets the ScatterShape this DataSet should be drawn with. This will search for an available IShapeRenderer and set this
renderer for the DataSet.
@param shape | public setScatterShape(shape: ChartShape): void {
this.mShapeRenderer = ScatterDataSet.getRendererForShape(shape) !;
} | AST#method_declaration#Left public setScatterShape AST#parameter_list#Left ( AST#parameter#Left shape : AST#type_annotation#Left AST#primary_type#Left ChartShape 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#prim... | public setScatterShape(shape: ChartShape): void {
this.mShapeRenderer = ScatterDataSet.getRendererForShape(shape) !;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L100-L102 | 004cadd912e1ff576363704923423aad1d6bb0b7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets | arkts | getImageSourceByFilePath | 通过沙箱路径直接获取文件资源实例
@param fileName - 文件名称。
@returns 图片资源实例。 | public getImageSourceByFilePath(fileName: string): image.ImageSource {
// [Start pixelmap_get_image_by_filepath]
const context: Context = getContext(this);
// fileName可使用'/test.jpg',也可以根据实际环境传入其他图片名
const filePath: string = context.cacheDir + fileName;
// [End pixelmap_get_image_by_filepath]
// ... | AST#method_declaration#Left public getImageSourceByFilePath AST#parameter_list#Left ( AST#parameter#Left fileName : 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#q... | public getImageSourceByFilePath(fileName: string): image.ImageSource {
const context: Context = getContext(this);
const filePath: string = context.cacheDir + fileName;
const imageSource: image.ImageSource = image.createImageSource(filePath);
return imageSource;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L44-L55 | 771bbcb0bf9c5d3924ba0bb6d799e668f0e4c862 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/utils/RecordUtil.ets | arkts | 根据偏移计算模式:0=语音录制,1=转文字,2=取消
@param offsetX
@param offsetY
@returns | export function getMode(offsetX: number, offsetY: number): number {
if (offsetX < 0) {
return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.CANCEL : VerifyModeEnum.VOICE;
} else {
return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.TEXT : VerifyModeEnum.VOICE;
}
} | AST#export_declaration#Left export AST#function_declaration#Left function getMode AST#parameter_list#Left ( AST#parameter#Left offsetX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offsetY : AST#type_annotation#Left AST#... | export function getMode(offsetX: number, offsetY: number): number {
if (offsetX < 0) {
return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.CANCEL : VerifyModeEnum.VOICE;
} else {
return offsetY <= Const.GESTURE_DISTANCE ? VerifyModeEnum.TEXT : VerifyModeEnum.VOICE;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/utils/RecordUtil.ets#L46-L52 | 6c00c6b263947115b8056f894bb8fa1d0d804684 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieData.ets | arkts | getDataSet | Returns the DataSet this PieData object represents. A PieData object can
only contain one DataSet.
@return | public getDataSet(): IPieDataSet {
return this.mDataSets.get(0);
} | AST#method_declaration#Left public getDataSet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IPieDataSet 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_exp... | public getDataSet(): IPieDataSet {
return this.mDataSets.get(0);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieData.ets#L63-L65 | cdec89b9b4f548f56c74d3a0c1ea77e2f09b0068 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment2.ets | arkts | Example | [Start Counter_example1] | @Component
export struct Example {
build() {
Column() {
// Custom Components
FlowListStruct(
// Custom Component Passing Parameters
// ...
).backgroundColor('#FFFFFF')
}
.width('100%')
.height('100%')
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Example AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { /... | @Component
export struct Example {
build() {
Column() {
FlowListStruct(
).backgroundColor('#FFFFFF')
}
.width('100%')
.height('100%')
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Nesting_Optimization/entry/src/main/ets/segment/segment2.ets#L8-L21 | ac8bb2e86e686ef3f1fa4cf29d06f3d960d2ac92 | gitee |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/pages/RecommendPage.ets | arkts | getAspectRatio | 计算图片的宽高比
@param imageWidth 图片宽度(px)
@param imageHeight 图片高度(px)
@returns 宽高比(width / height),如果无法计算则返回默认值 | private getAspectRatio(imageWidth: number, imageHeight: number): number {
// 如果宽高都有效且大于0,直接计算宽高比
if (imageWidth > 0 && imageHeight > 0) {
return imageWidth / imageHeight;
}
// 如果宽高无效或为0,返回默认宽高比
// 可以根据业务需求选择:1.0(正方形)或 16/9(常见视频比例)
// 这里使用 16/9,因为推荐页通常包含视频内容
return DEFAULT_ASPECT_RATIO... | AST#method_declaration#Left private getAspectRatio AST#parameter_list#Left ( AST#parameter#Left imageWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageHeight : AST#type_annotation#Left AST#primary_type#Left number... | private getAspectRatio(imageWidth: number, imageHeight: number): number {
if (imageWidth > 0 && imageHeight > 0) {
return imageWidth / imageHeight;
}
return DEFAULT_ASPECT_RATIO;
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/pages/RecommendPage.ets#L194-L204 | 532c002b508c71bda10815809067d0301c87f5ce | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Address.ets | arkts | Address | 地址类 | @Observed
export class Address {
name?: string;
phone?: string;
address?: string;
tag?: string;
defaultFlag: boolean = false;
constructor(name: string, phone: string, address: string, tag: string, defaultFlag: boolean) {
this.name = name;
this.phone = phone;
this.address = address;
this.tag... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Address AST#class_body#Left { AST#property_declaration#Left name ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_d... | @Observed
export class Address {
name?: string;
phone?: string;
address?: string;
tag?: string;
defaultFlag: boolean = false;
constructor(name: string, phone: string, address: string, tag: string, defaultFlag: boolean) {
this.name = name;
this.phone = phone;
this.address = address;
this.tag... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Address.ets#L19-L42 | 38c70ab531592bed7a21b61c58333dfeeec7f48e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | setGestureBackEnabled | 设置当前窗口是否禁用返回手势功能,仅主窗全屏模式下生效,2in1设备下不生效。<API13+>
@param enabled true时开启返回手势功能,false时禁用返回手势功能。
@param windowClass 不传该值,默认主窗口。
@returns | static async setGestureBackEnabled(enabled: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
if (AppUtil.isApiSupported(13)) {
return windowClass.setGestureBackEnabled(enabled);
}
} | AST#method_declaration#Left static async setGestureBackEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#L... | static async setGestureBackEnabled(enabled: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
if (AppUtil.isApiSupported(13)) {
return windowClass.setGestureBackEnabled(enabled);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L398-L403 | e8b2d9967def4cfcbf188f2d430f149b491ff8c6 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | getMonth | 获取月份(1-12) | getMonth(): number {
return this.date.month;
} | AST#method_declaration#Left getMonth 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_expression#Left... | getMonth(): number {
return this.date.month;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L170-L172 | b917b3bc0762603deceac9da56011c0bbaf4272c | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/EncourageManager.ets | arkts | getPrefs | ============================================================ 内部工具方法 ============================================================ 获取Preferences实例(类似Swift的UserDefaults) | private getPrefs(): preferences.Preferences {
const context = getAppContext();
return preferences.getPreferencesSync(context, { name: Pref.Name });
} | AST#method_declaration#Left private getPrefs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST... | private getPrefs(): preferences.Preferences {
const context = getAppContext();
return preferences.getPreferencesSync(context, { name: Pref.Name });
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L114-L117 | 37e772cf6d821397c9abff54515b551a75895a34 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets | arkts | genKeyMaterialBlob | Data of the DataBlob type is generated based on the data group.
@param data Data to be encapsulated.
@returns DataBlob data | genKeyMaterialBlob(data: Array<number>): cryptoFramework.DataBlob {
let keyMaterial = new Uint8Array(data);
return { data: keyMaterial };
} | AST#method_declaration#Left genKeyMaterialBlob AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_argume... | genKeyMaterialBlob(data: Array<number>): cryptoFramework.DataBlob {
let keyMaterial = new Uint8Array(data);
return { data: keyMaterial };
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets#L56-L59 | 655fa855b17743a25e0285a7f92d46ac2fe9d0aa | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets | arkts | getAllData | 获取所有数据
@returns | public getAllData(): T[] {
return this.originDataArray;
} | AST#method_declaration#Left public getAllData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left retu... | public getAllData(): T[] {
return this.originDataArray;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L45-L47 | f3c0a7e0d61370a38f952b0e1b5e0d9f016d920e | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/Index.ets | arkts | RouteBuild | @file navigation 模块统一导出
@author Joker.X | export { RouteBuild } from "./src/main/ets/RouteBuild"; | AST#export_declaration#Left export { RouteBuild } from "./src/main/ets/RouteBuild" ; AST#export_declaration#Right | export { RouteBuild } from "./src/main/ets/RouteBuild"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/Index.ets#L6-L6 | f9e38a676538403e3a9a8c0ce9b5b99f7caeb138 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | decryptCBC | 解密(CBC模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。
@returns | static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> {
return AES.decrypt(data, symKey, ivParams, transformation);
} | AST#method_declaration#Left static async decryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym... | static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'AES256|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> {
return AES.decrypt(data, symKey, ivParams, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L137-L140 | 2f7df1459d53dfc53cedc756975fe4147ec6fe6f | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowScratchingBoard.ets | arkts | default_action | Actions
The default actions for link, text and image when clicked. | default_action() {
if (this.type == 'url') {
this.open_url(this.text);
}
if (this.type == 'text') {
this.copy_text(this.text);
}
if (this.type == 'image') {
preview_image(this.text, this.storage);
}
} | AST#method_declaration#Left default_action AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#... | default_action() {
if (this.type == 'url') {
this.open_url(this.text);
}
if (this.type == 'text') {
this.copy_text(this.text);
}
if (this.type == 'image') {
preview_image(this.text, this.storage);
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowScratchingBoard.ets#L364-L374 | 453ce62381352adc385c10a6da31ceb4fcfea6ea | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets | arkts | @Author csx
@DateTime 2024/3/18 10:37:03
@TODO SM3Sync SM3同步工具类 | export class SM3Sync {
/**
* SM3摘要
* @param str 带摘要的字符串
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 摘要后的字符串
*/
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'SM3', resultCoding);
}
/**
... | AST#export_declaration#Left export AST#class_declaration#Left class SM3Sync AST#class_body#Left { /**
* SM3摘要
* @param str 带摘要的字符串
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 摘要后的字符串
*/ AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : A... | export class SM3Sync {
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.digest(str, 'SM3', resultCoding);
}
static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.hmac(str, '... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets#L27-L47 | 75aa1bd082dd31b0e95eff71f7976f9bc398b553 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/PrefetchResource.ets | arkts | onCreate | EntryAbility.ets | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
console.log('EntryAbility onCreate.');
webview.WebviewController.initializeWebEngine();
// When pre-acquiring, 'https://www.example1.com/POST? E=f&g=h' is replaced by the actual website address to be visited.
webview.WebviewControlle... | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
console.log('EntryAbility onCreate.');
webview.WebviewController.initializeWebEngine();
webview.WebviewController.prefetchResource(
{
url: 'https://www.example.com/POST?e=f&g=h',
method: 'POST',
formDat... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/PrefetchResource.ets#L7-L25 | e38f770658cdbc7b53dc10827ece844463f887a9 | gitee |
conrad_sheeran/TickAuth | 8ef852e12999d15cf70394cdab82d08ac5843143 | features/settings/src/main/ets/model/SettingsItemModel.ets | arkts | Copyright (c) 2024 Yang He
TickAuth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be... | export class SettingsItemClass {
symbol: string = ""
title: string = "";
content: string = "";
constructor(symbol: string, title: string, content: string) {
this.symbol = symbol;
this.title = title;
this.content = content;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class SettingsItemClass AST#class_body#Left { AST#property_declaration#Left symbol : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#ERROR#Left title : s... | export class SettingsItemClass {
symbol: string = ""
title: string = "";
content: string = "";
constructor(symbol: string, title: string, content: string) {
this.symbol = symbol;
this.title = title;
this.content = content;
}
} | https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/settings/src/main/ets/model/SettingsItemModel.ets#L18-L28 | cefc641119a39bbdc0db876469fb685fac628c66 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppContext.ets | arkts | initUIContext | 初始化 UI 上下文。
通常在页面或组件的 aboutToAppear() 生命周期中调用。 | static initUIContext(context: UIContext): void {
AppContext._uiContext = context
} | AST#method_declaration#Left static initUIContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima... | static initUIContext(context: UIContext): void {
AppContext._uiContext = context
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppContext.ets#L41-L43 | f7c68dc50f554daea1310abae3ae34ea5d892c54 | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSWantOpenManageApplications/entry/src/main/ets/pages/Index.ets | arkts | implicitStartAbility | 隐示启动Ability | async implicitStartAbility() {
try {
let want = {
// 调用应用管理
"action": "ohos.settings.manage.applications"
}
let context = getContext(this) as common.UIAbilityContext;
await context.startAbility(want)
console.info(`implicit start ability succeed`)
} catch (error) {
... | AST#method_declaration#Left async implicitStartAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left want = AST#expression#Left AST... | async implicitStartAbility() {
try {
let want = {
"action": "ohos.settings.manage.applications"
}
let context = getContext(this) as common.UIAbilityContext;
await context.startAbility(want)
console.info(`implicit start ability succeed`)
} catch (error) {
cons... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSWantOpenManageApplications/entry/src/main/ets/pages/Index.ets#L21-L33 | 13221db4abc3eb5347e6ab47642ad9d0b17432e1 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/StatusBarUtils.ets | arkts | 状态栏工具类 | export class StatusBarUtil {
// 使用静态属性存储状态栏高度,便于全局访问
private static readonly STATUS_BAR_HEIGHT_KEY: string = 'statusBarHeight';
/**
* 设置状态栏的内容颜色(文字和图标的颜色)
* 类似于SwiftUI中修改UIApplication.shared.statusBarStyle
* @param color 颜色字符串,例如 '#000000' (黑色) 或 '#FFFFFF' (白色)
* @param context 上下文对象
*/
static a... | AST#export_declaration#Left export AST#class_declaration#Left class StatusBarUtil AST#class_body#Left { // 使用静态属性存储状态栏高度,便于全局访问 AST#property_declaration#Left private static readonly STATUS_BAR_HEIGHT_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expre... | export class StatusBarUtil {
private static readonly STATUS_BAR_HEIGHT_KEY: string = 'statusBarHeight';
static async setStatusBarContentColor(color: string): Promise<void> {
try {
const context = getContext(StatusBarUtil)
const currentWindow = await window.getLastWindow(context);
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/StatusBarUtils.ets#L6-L101 | fac39b8478e193e6380abad956202c87b4e2e0bc | github | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/pages/MerchantDetailPage.ets | arkts | toggleFavorite | 切换收藏状态 | private async toggleFavorite(): Promise<void> {
if (!this.merchant) {
return;
}
try {
await this.favoriteManager.toggleFavorite(this.merchant.id);
const isFavorited = this.favoriteIds.includes(this.merchant.id);
promptAction.showToast({
message: isFavorited ? '已添加到收藏'... | AST#method_declaration#Left private async toggleFavorite 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... | private async toggleFavorite(): Promise<void> {
if (!this.merchant) {
return;
}
try {
await this.favoriteManager.toggleFavorite(this.merchant.id);
const isFavorited = this.favoriteIds.includes(this.merchant.id);
promptAction.showToast({
message: isFavorited ? '已添加到收藏'... | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/pages/MerchantDetailPage.ets#L108-L128 | 1f35546214830be17c2eb9c9525f227b84fc8f9e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CrashUtil.ets | arkts | delete | 删除日志文件
@returns | static delete() {
if (CrashUtil.access()) {
const path = CrashUtil.getFilePath();
FileUtil.unlinkSync(path);
}
} | AST#method_declaration#Left static delete AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CrashUtil AST#expression#Right . access ... | static delete() {
if (CrashUtil.access()) {
const path = CrashUtil.getFilePath();
FileUtil.unlinkSync(path);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L120-L125 | 66a60c1ee27e53f61ab9ed5928980d54a6b9bef3 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets | arkts | appItemWithNameView | 应用类别里每一个应用和位移动画过程中的展示样式
@param data app信息和首页应用里的appName | @Builder
appItemWithNameView(data: AddedIconWithNameViewMode) {
Stack({ alignContent: Alignment.TopEnd }) {
Image(data.app.icon)
.width($r('app.string.grid_exchange_icon_size'))
.height($r('app.string.grid_exchange_icon_size'))
.interpolation(ImageInterpolation.High)
.syncLoa... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right appItemWithNameView AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AddedIconWithNameViewMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AS... | @Builder
appItemWithNameView(data: AddedIconWithNameViewMode) {
Stack({ alignContent: Alignment.TopEnd }) {
Image(data.app.icon)
.width($r('app.string.grid_exchange_icon_size'))
.height($r('app.string.grid_exchange_icon_size'))
.interpolation(ImageInterpolation.High)
.syncLoa... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L83-L112 | 491aece9d105104a4db96f41d2ea7b90d78762f5 | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | getCurrentStackName | 获取当前路由栈名称
@returns | public static getCurrentStackName(): string {
return ZRouter.getRouterMgr().currentStackName
} | AST#method_declaration#Left public static getCurrentStackName 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 A... | public static getCurrentStackName(): string {
return ZRouter.getRouterMgr().currentStackName
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L347-L349 | 0436a27789048962622baebaa0193c4dab61b4fc | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/TodoTypes.ets | arkts | 变更值接口 | export interface ChangeValue {
old: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined;
new: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ChangeValue AST#object_type#Left { AST#type_member#Left old : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean... | export interface ChangeValue {
old: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined;
new: string | number | boolean | TodoPriority | TodoStatus | TodoType | string[] | null | undefined;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/TodoTypes.ets#L176-L179 | 6534b5f32e71ab83a49d902ac2bd85dd07b773f6 | github | |
queueit/harmony-sdk.git | ba7b4b38c03730bfbe305789acba6db0012d5f5c | queueit_sdk/src/main/ets/Index.ets | arkts | QueueItEngine | src/main/ets/index.ets This file defines the public API of the Queue-it ArkTS SDK. Application developers will import SDK components from here. --- Core Engine & Listener --- | export { QueueItEngine } from './main/QueueItEngine'; | AST#export_declaration#Left export { QueueItEngine } from './main/QueueItEngine' ; AST#export_declaration#Right | export { QueueItEngine } from './main/QueueItEngine'; | https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/Index.ets#L6-L6 | 5e0252630db06c35f4453619d1dd2ed9076db9c8 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isWeakMap | Check whether the entered value is of type weakmap.
@param { Object } value - A WeakMap value
@returns { boolean } Returns true if the value is a built-in WeakMap instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isWeakMap(value: Object): boolean; | AST#method_declaration#Left isWeakMap AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right... | isWeakMap(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1400-L1400 | 03c5c448293f05566ac44989485fa91b1d173bee | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets | arkts | GestureGroupExample | 功能描述: 本示例使用AVrecord录制音频和AVrecord的getAudioCapturerMaxAmplitude接口获取振幅实现UI动效;使用AVplayer播放音频
推荐场景: 语音录制场景
核心组件:
1. AudioRecorder
实现步骤:
1. 利用AVrecord录制音频病获取音频振幅
2. 利用振幅的变化,换算出column的height并加上动画效果
3. 使用AVplayer播放录制的音频文件 | @Component
export struct GestureGroupExample {
@State bottomHeight: number = 0; // 底部系统导航栏高度
@State messages: Array<Message> = messageList;
@State columnX: number = Const.COLUMN_WIDTH; // Column宽度
@State yMax: number = Const.OPACITY_FALSE; // Column高度最大值
@State yMin: number = Const.OPACITY_FALSE; // Column高度最... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct GestureGroupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right bottomHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AS... | @Component
export struct GestureGroupExample {
@State bottomHeight: number = 0;
@State messages: Array<Message> = messageList;
@State columnX: number = Const.COLUMN_WIDTH;
@State yMax: number = Const.OPACITY_FALSE;
@State yMin: number = Const.OPACITY_FALSE;
@State isListening: boolean = false;
@State ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/pages/Index.ets#L43-L460 | 4c1ddfbb0a70376ee183a2d9a1672acf81a3f298 | gitee |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/utils/DialogUtils.ets | arkts | 展示loading
@param tips | export function showLoadingDialog(tips: string = "加载中") {
emitter.emit(loadingEvent, LoadingDialogEvent(true, tips))
} | AST#export_declaration#Left export AST#function_declaration#Left function showLoadingDialog AST#parameter_list#Left ( AST#parameter#Left tips : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "加载中" AST#expression#Right AST#parameter#Right ) AS... | export function showLoadingDialog(tips: string = "加载中") {
emitter.emit(loadingEvent, LoadingDialogEvent(true, tips))
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/utils/DialogUtils.ets#L9-L11 | df0bc07394f800059637d8764bc77eb2f55536b3 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/viewmodel/SongData.ets | arkts | Music information entity class. | export class SongItem {
/**
* Primary key ID.
*/
id: number = 0;
/**
* Music name.
*/
title: string = '';
/**
* Music author name.
*/
singer: string = '';
/**
* Music logo information.
*/
mark: Resource = $r('app.string.page_show');
/**
* Music avatar information.
*/
... | AST#export_declaration#Left export AST#class_declaration#Left class SongItem AST#class_body#Left { /**
* Primary key ID.
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#p... | export class SongItem {
id: number = 0;
title: string = '';
singer: string = '';
mark: Resource = $r('app.string.page_show');
label: Resource = $r('app.string.page_show');
src: string = '';
index: number = 0;
lyric: string = '';
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/common/mediaCommon/src/main/ets/viewmodel/SongData.ets#L19-L59 | 8570f5592be13ad32377dbb7138aa00e1d1e688b | github | |
gracienewd/openharmony-App-YunmoAi.git | 181952ab00aab5025a81b7b3a6b88d2a5258c76a | entry/src/main/ets/views/dialog/BuiCustomDialog.ets | arkts | empty | 作为全局弹窗组件封装 内容完全由外部slot定义 | @Builder function empty(){} | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function empty AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#decorated_function_declaration#Right | @Builder function empty(){} | https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/views/dialog/BuiCustomDialog.ets#L5-L5 | cedb5f71812ce3d99eb91e42f78ff8f49977e6d0 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | createTables | 创建数据表 | private async createTables(): Promise<void> {
try {
// 创建联系人表
const createContactsTableSql = `
CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_CONTACTS} (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
avatar TEXT,
phone TEXT,
email TEXT,
... | AST#method_declaration#Left private async createTables AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#... | private async createTables(): Promise<void> {
try {
const createContactsTableSql = `
CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_CONTACTS} (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
avatar TEXT,
phone TEXT,
email TEXT,
relation... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L60-L166 | 276f25b07dddb2cd734ac956c40a3040d4d38823 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppConstants.ets | arkts | 应用常量配置
对应Kotlin的object AppConstants | export class AppConstants {
// 应用程序文档根目录名称
private static readonly APP_DOCUMENT: string = "app_Document";
private static readonly APP_DATABASE: string = "app_Database";//必须是rdb开头的目录
//应用程序Database目录
private static readonly APP_RDB: string = "rdb";//必须是rdb开头的目录
/**
* 获取应用文档根目录路径(以斜杠结尾)
* 对应Kot... | AST#export_declaration#Left export AST#class_declaration#Left class AppConstants AST#class_body#Left { // 应用程序文档根目录名称 AST#property_declaration#Left private static readonly APP_DOCUMENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "app_Doc... | export class AppConstants {
private static readonly APP_DOCUMENT: string = "app_Document";
private static readonly APP_DATABASE: string = "app_Database";
private static readonly APP_RDB: string = "rdb";
static get docBasePath(): string {
const context = getAppContext()
return `${c... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppConstants.ets#L10-L43 | 43d73ff25a2c3b06da50afb754a37551d7486c53 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets | arkts | pushData | 增加数据
@param data | public pushData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AS... | public pushData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L71-L74 | 482f362e20d2948beeab559504b0bd8ea5f20c75 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.