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/highlight/ChartHighlighter.ets | arkts | getDistance | Calculates the distance between the two given points.
@param x1
@param y1
@param x2
@param y2
@return | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
//return Math.abs(y1 - y2);
//return Math.abs(x1 - x2);
return Math.hypot(x1 - x2, y1 - y2);
} | AST#method_declaration#Left protected getDistance AST#parameter_list#Left ( AST#parameter#Left x1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
return Math.hypot(x1 - x2, y1 - y2);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/ChartHighlighter.ets#L274-L278 | ea924ed75d61295b29b50df26bae51fe8be6e4dd | gitee |
Zairgs/ArKTSMovie.git | 1586c977f12722333eee7d74a71f006ba0606ade | ets/pages/RealNameInfoPage.ets | arkts | validateForm | 表单验证 | private validateForm(): boolean {
if (!this.name) {
console.log("请输入姓名")
return false
}
if (!this.idNumber) {
console.log("请输入证件号")
return false
}
if (!this.agreeProtocol) {
console.log("请同意实名协议")
return false
}
return true
} | AST#method_declaration#Left private validateForm AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expressi... | private validateForm(): boolean {
if (!this.name) {
console.log("请输入姓名")
return false
}
if (!this.idNumber) {
console.log("请输入证件号")
return false
}
if (!this.agreeProtocol) {
console.log("请同意实名协议")
return false
}
return true
} | https://github.com/Zairgs/ArKTSMovie.git/blob/1586c977f12722333eee7d74a71f006ba0606ade/ets/pages/RealNameInfoPage.ets#L133-L147 | bae028065be9457007fd0622ca2056404537b44a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/MDNS_case/entry/src/main/ets/pages/Index.ets | arkts | addLocalService | [Start manage_local_services] | private addLocalService(): void {
this.addServiceStatus = serviceOperateStatus.ADDING;
mdns.addLocalService(context, this.localServiceInfo).then((data) => {
this.addServiceStatus = serviceOperateStatus.ADD_SUCCESS;
Logger.info(`Local Service Added: ${JSON.stringify(data)}`);
}).catch((err: Busin... | AST#method_declaration#Left private addLocalService AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Lef... | private addLocalService(): void {
this.addServiceStatus = serviceOperateStatus.ADDING;
mdns.addLocalService(context, this.localServiceInfo).then((data) => {
this.addServiceStatus = serviceOperateStatus.ADD_SUCCESS;
Logger.info(`Local Service Added: ${JSON.stringify(data)}`);
}).catch((err: Busin... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/MDNS_case/entry/src/main/ets/pages/Index.ets#L213-L222 | f0841a05312fffae310f212fc74d7e884e517594 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | ReminderMode, include NONE, TOAST and MASK
@enum { number } ReminderMode
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum ReminderMode {
/**
* NONE. no need to remind
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
NONE = 0,
/**
* TOAST. remind by toast
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelpe... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum ReminderMode AST#enum_body#Left { /**
* NONE. no need to remind
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#enum_member#Left N... | export declare enum ReminderMode {
NONE = 0,
TOAST = 1,
MASK = 2
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L671-L696 | 9901a3ae0c9da42988c46f18a862a549c5e28a5f | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/blendmode/src/main/ets/view/BlendModeView.ets | arkts | BlendModeViewComponent | 功能描述: 本实例主要通过BlendMode属性来实现挂件和图片的混合,通过更改不同的混合参数,能够展示不同的混合效果。
推荐场景: 头像编辑场景
核心组件:
1. Image组件
实现步骤:
1. 挂件Image组件绑定BlendMode属性,属性值初始化为BlendMode.NONE。
2. 点击挂件区域,通过currentBlendMode变量来改变混合模式。 | @Component
export struct BlendModeViewComponent {
@Builder
titleBar() {
Text($r('app.string.blend_mode_avatar_pendant'))
.fontSize($r('app.integer.blend_mode_title_font_size'))
.width($r('app.string.blend_mode_container_size'))
.textAlign(TextAlign.Center)
}
build() {
Column() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BlendModeViewComponent AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right titleBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Lef... | @Component
export struct BlendModeViewComponent {
@Builder
titleBar() {
Text($r('app.string.blend_mode_avatar_pendant'))
.fontSize($r('app.integer.blend_mode_title_font_size'))
.width($r('app.string.blend_mode_container_size'))
.textAlign(TextAlign.Center)
}
build() {
Column() {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/blendmode/src/main/ets/view/BlendModeView.ets#L33-L53 | b8cb59662d12a5841702a286caa0a2c81048139d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/model/DialogOptions.ets | arkts | 多个按钮的AlertDialog参数类 | export class OptionDialogOptions extends DialogOptions {
dialogId?: string; //弹框ID
buttons?: Array<ButtonOptions | ResourceStr> //弹窗容器中的多个按钮。
buttonDirection?: DialogButtonDirection //按钮排布方向默认值为DialogButtonDirection.AUTO,建议3个以上按钮使用Auto模式(两个以上按钮会切换为纵向模式,通常能显示更多按钮),非Auto模式下,3个以上按钮可能会显示不全,超出显示范围的按钮会被截断。
} | AST#export_declaration#Left export AST#class_declaration#Left class OptionDialogOptions extends AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left dialogId ? : AST#type_annotation#Left AST#primary_type#Left st... | export class OptionDialogOptions extends DialogOptions {
dialogId?: string;
buttons?: Array<ButtonOptions | ResourceStr>
buttonDirection?: DialogButtonDirection
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/model/DialogOptions.ets#L86-L90 | 2f74940b78d21f458eeff0cbbe3dd1adbb2bcc34 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets | arkts | onSearchClicked | 1.搜索框进入搜索页面animateTo显式动画。
2.两个搜索框同时绑定同一个geometryId。 | private onSearchClicked(): void {
this.geometryId = 'search';
animateTo({
duration: 100,
// 构造插值器弹簧曲线对象,生成一条从0到1的动画曲线
curve: curves.interpolatingSpring(0, 1, 324, 38)
}, () => {
this.isSearchPageShow = true;
})
} | AST#method_declaration#Left private onSearchClicked AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_e... | private onSearchClicked(): void {
this.geometryId = 'search';
animateTo({
duration: 100,
curve: curves.interpolatingSpring(0, 1, 324, 38)
}, () => {
this.isSearchPageShow = true;
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets#L122-L131 | beb515b9de9e0e70aa0bbb753d266a202267e59b | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/model/MessagesData.ets | arkts | messageItemKey | 在List中使用LazyForEach时,响应式ui需要key变化才会更新,本方法就是按可变的内容计算key,从而在DataSource更新时,
能让ui感知到,不然UI是不会刷新显示的。
@param m 消息对象
@returns 计算出的key | static messageItemKey(m: Message) {
// 优化点:给更新的消息对象加个最近更新时间戳,这应该是个更通用的key计算项,不然一旦变更内容多了,这个key的计算就不那么优雅了
return m.msgType + '-' + m.fingerPrintOfProtocal + '-' + m.sendStatus;
} | AST#method_declaration#Left static messageItemKey AST#parameter_list#Left ( AST#parameter#Left m : AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 优化点:给更新的消息对象加个最近更新时间戳,这应该是个更通用的key计算项,不然... | static messageItemKey(m: Message) {
return m.msgType + '-' + m.fingerPrintOfProtocal + '-' + m.sendStatus;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/MessagesData.ets#L38-L41 | ae4a37358e8ec7411bd941a2551c9f56dc6afd95 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/datatype/primitives/primitives_boolean_001_T.ets | arkts | Introduction 基础数据类型-boolean | export function primitives_boolean_001_T(taint_src : boolean) : void {
taint.Sink(taint_src);
} | AST#export_declaration#Left export AST#function_declaration#Left function primitives_boolean_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : 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_an... | export function primitives_boolean_001_T(taint_src : boolean) : void {
taint.Sink(taint_src);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/primitives/primitives_boolean_001_T.ets#L7-L9 | d9bec6e4ae7f4cc2ae3d23fc222424d2b427a796 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | BackgroundBlur/entry/src/main/ets/pages/ReduceBlurRadius.ets | arkts | aboutToAppear | Bottom navigation bar height. | aboutToAppear(): void {
window.getLastWindow(this.getUIContext().getHostContext()!, (err, windowBar) => {
if (err.code) {
return;
}
// get the height of the bottom navigation bar.
this.bottomSafeHeight = this.getUIContext()
.px2vp(windowBar.getWindowAvoidArea(window.AvoidArea... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
window.getLastWindow(this.getUIContext().getHostContext()!, (err, windowBar) => {
if (err.code) {
return;
}
this.bottomSafeHeight = this.getUIContext()
.px2vp(windowBar.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR).bottomRect.heig... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BackgroundBlur/entry/src/main/ets/pages/ReduceBlurRadius.ets#L69-L79 | 7800d4a5c3ff41746f3e9156d186a76d2003fdcf | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/view/VideoPlaySlider.ets | arkts | VideoSlider | video slider component | @Component
export struct VideoSlider {
@Consume isOpacity: boolean;
@Consume currentStringTime: string;
@Consume currentTime: number;
@Consume durationTime: number;
@Consume durationStringTime: string;
@Consume isPlay: boolean;
@Consume flag: boolean;
@Consume isLoading: boolean;
@Consume progressVal:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoSlider AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isOpacity : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_a... | @Component
export struct VideoSlider {
@Consume isOpacity: boolean;
@Consume currentStringTime: string;
@Consume currentTime: number;
@Consume durationTime: number;
@Consume durationStringTime: string;
@Consume isPlay: boolean;
@Consume flag: boolean;
@Consume isLoading: boolean;
@Consume progressVal:... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/view/VideoPlaySlider.ets#L30-L133 | 88817a472935fbeaa903388303314b9beab61cb8 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | 预设通知配置
@param {Partial<NotificationBasicOptions>} configs 预设值的配置项 | export function PresetConfig (configs: (config: Partial<NotificationBasicOptions>) => void) {
configs(PresetNotificationConfig)
} | AST#export_declaration#Left export AST#function_declaration#Left function PresetConfig AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial... | export function PresetConfig (configs: (config: Partial<NotificationBasicOptions>) => void) {
configs(PresetNotificationConfig)
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L475-L477 | 4e9b2bda8290f6318bf650bbd97c11f4428e44d1 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/keyboardavoid/src/main/ets/basicDataResource/BasicDataSource.ets | arkts | modifyAllData | 改变数组数据
@param data:新数组 | public modifyAllData(data: string[]): void {
this.dataArray = data;
this.notifyDataReload();
} | AST#method_declaration#Left public modifyAllData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Le... | public modifyAllData(data: string[]): void {
this.dataArray = data;
this.notifyDataReload();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/basicDataResource/BasicDataSource.ets#L178-L181 | 22f5676796bef985a05cd5c4886d4a69c15cdd52 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | buildSelectedDayBirthdays | 构建选中日期的生日 | @Builder
buildSelectedDayBirthdays() {
if (this.selectedDayBirthdays.length === 0) {
Column({ space: 16 }) {
Text('这一天没有人过生日')
.fontSize(14)
.fontColor('#999999')
.textAlign(TextAlign.Center)
Button('清除选择')
.type(ButtonType.Capsule)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSelectedDayBirthdays 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#membe... | @Builder
buildSelectedDayBirthdays() {
if (this.selectedDayBirthdays.length === 0) {
Column({ space: 16 }) {
Text('这一天没有人过生日')
.fontSize(14)
.fontColor('#999999')
.textAlign(TextAlign.Center)
Button('清除选择')
.type(ButtonType.Capsule)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L414-L448 | dafe94b73627617a337d67dbe1c0651519af960d | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets | arkts | operateButtonStyle | Custom button style. | @Extend(Button) function operateButtonStyle(color: Resource) {
.width($r('app.float.button_width'))
.height($r('app.float.button_height'))
.fontSize($r('app.float.button_font'))
.fontWeight(CommonConstants.FONT_WEIGHT)
.fontColor(color)
.backgroundColor($r('app.color.button_background'))
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Button AST#expression#Right ) AST#decorator#Right function operateButtonStyle AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#... | @Extend(Button) function operateButtonStyle(color: Resource) {
.width($r('app.float.button_width'))
.height($r('app.float.button_height'))
.fontSize($r('app.float.button_font'))
.fontWeight(CommonConstants.FONT_WEIGHT)
.fontColor(color)
.backgroundColor($r('app.color.button_background'))
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets#L184-L191 | 0d0867ce0ad54a4d7e3c33e89bd0a6357050fca3 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets | arkts | writeData | write data.
@param fruit Fruit data. | writeData(fruit: Fruit) {
// Check whether the data is null.
let isDataNull = this.checkFruitData(fruit);
if (isDataNull) {
return;
}
// The data is inserted into the preferences database if it is not empty.
this.putPreference(fruit);
this.showToastMessage($r('app.string.write_success_... | AST#method_declaration#Left writeData AST#parameter_list#Left ( AST#parameter#Left fruit : AST#type_annotation#Left AST#primary_type#Left Fruit AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // Check whether the data is null. AST#statement#Left... | writeData(fruit: Fruit) {
let isDataNull = this.checkFruitData(fruit);
if (isDataNull) {
return;
}
this.putPreference(fruit);
this.showToastMessage($r('app.string.write_success_msg'));
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L125-L134 | ab2e28116ecbc9385f053e370d9d3243995df9a6 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | destroy | 销毁实例(释放资源) | destroy(): void {
this.stop();
this.callback = null;
} | AST#method_declaration#Left destroy 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 ... | destroy(): void {
this.stop();
this.callback = null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L138-L141 | ebf5b427217d85de215d04f95fd9289916a3ef0d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/analytics/DashboardPage.ets | arkts | buildTabBar | 构建标签栏 | @Builder
buildTabBar() {
Scroll() {
Row({ space: 0 }) {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 6 }) {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedTab === index ? $r(... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_elem... | @Builder
buildTabBar() {
Scroll() {
Row({ space: 0 }) {
ForEach(this.tabs, (tab, index: number) => {
Column({ space: 6 }) {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedTab === index ? $r(... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/DashboardPage.ets#L280-L319 | da06526f3b72763c371116f7cfe1ff8d56461176 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/networks/Server_Routes.ets | arkts | 获取指定路由的完整地址 | export function getRouteAddress(route: Route): string {
return `${Servers.getAddress(route)}/${route}`;
} | AST#export_declaration#Left export AST#function_declaration#Left function getRouteAddress AST#parameter_list#Left ( AST#parameter#Left route : AST#type_annotation#Left AST#primary_type#Left Route AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A... | export function getRouteAddress(route: Route): string {
return `${Servers.getAddress(route)}/${route}`;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Server_Routes.ets#L59-L61 | d7fbf790fea3386b789a4bbebd5ff6a285c56a52 | github | |
xsdkhlgz/ATSOBJECT_OF_FIRST.git | 8c14e875d7ec3f418bb7cdaae123a8fea87a7e76 | entry/src/main/ets/model/RecordModel.ets | arkts | queryByDate | 改 查 | queryByDate(date:number): Promise<RecordPO[]>{
//1.查询条件
let predicates = new relationalStore.RdbPredicates(TABLE_NAME)
predicates.equalTo(Date_COLUMN,date)
//2.查询
return DbUtil.queryFortList(predicates,COLUMNS)
} | AST#method_declaration#Left queryByDate AST#parameter_list#Left ( AST#parameter#Left date : 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_type#Left Promise... | queryByDate(date:number): Promise<RecordPO[]>{
let predicates = new relationalStore.RdbPredicates(TABLE_NAME)
predicates.equalTo(Date_COLUMN,date)
return DbUtil.queryFortList(predicates,COLUMNS)
} | https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/model/RecordModel.ets#L52-L58 | 2405ed35b6acaaed40a120298e710fd9d3ccdc12 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/DatePickerDialogView.ets | arkts | TextPickerStyle | TextPicker统一样式 | @Extend(TextPicker)
function TextPickerStyle(options: IDateTimePickerOptions, contain: boolean, layoutWeight: number) {
.visibility(contain ? Visibility.Visible : Visibility.None)
.layoutWeight(layoutWeight)
.textStyle(options.style?.textStyle)
.selectedTextStyle(options.style?.selectedTextStyle)
.disappearTe... | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextPicker AST#expression#Right ) AST#decorator#Right function TextPickerStyle AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IDateTimePickerOptions AST#primary_type#Right AST... | @Extend(TextPicker)
function TextPickerStyle(options: IDateTimePickerOptions, contain: boolean, layoutWeight: number) {
.visibility(contain ? Visibility.Visible : Visibility.None)
.layoutWeight(layoutWeight)
.textStyle(options.style?.textStyle)
.selectedTextStyle(options.style?.selectedTextStyle)
.disappearTe... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/DatePickerDialogView.ets#L205-L214 | b8eb602255994e0c6404480e2b46d653e26c1f51 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/NotePadOpenHarmony/entry/src/main/ets/common/utils/Format.ets | arkts | @returns current time plus AM/PM, eg: 12:30 PM | export default function formatTime() {
let time = new Date();
let hourTip = '';
if(time.getHours() >= CommonConstants.START_HOUR_OF_MORNING &&
time.getHours() < CommonConstants.END_HOUR_OF_MORNING) {
hourTip = 'AM';
} else {
hourTip = 'PM';
}
return `${time.toTimeString().split(' ')[0]} ${hourTip}... | AST#export_declaration#Left export default AST#expression#Left AST#function_expression#Left function formatTime AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left time = AST#expression#Left AST#call_expression... | export default function formatTime() {
let time = new Date();
let hourTip = '';
if(time.getHours() >= CommonConstants.START_HOUR_OF_MORNING &&
time.getHours() < CommonConstants.END_HOUR_OF_MORNING) {
hourTip = 'AM';
} else {
hourTip = 'PM';
}
return `${time.toTimeString().split(' ')[0]} ${hourTip}... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/common/utils/Format.ets#L21-L31 | be422134b71cddbe391591bbe449ea6520b47cd6 | gitee | |
Nuist666/Alzheimer.git | c171b8e739357bfc5a3fc71c90aaea6ce5d463d1 | entry/src/main/ets/common/constants/CommonConstants.ets | arkts | component with or height percent | export const enum STRING_PERCENT {
SLIDER_WITH = '46.7%',
NINETY_PERCENT = '88%',
INDEX_COMPONENT_WITH_PERCENT = '93.3%',
INDEX_SWIPER_HEIGHT_PERCENT = '24.1%',
INDEX_MODULE_HEIGHT_PERCENT = '22.8%',
INDEX_SWIPER_LEFT_RIGHT_MARGIN = '3.3%'
} | AST#export_declaration#Left export AST#enum_declaration#Left const enum STRING_PERCENT AST#enum_body#Left { AST#enum_member#Left SLIDER_WITH = AST#expression#Left '46.7%' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NINETY_PERCENT = AST#expression#Left '88%' AST#expression#Right AST#enum_member#Rig... | export const enum STRING_PERCENT {
SLIDER_WITH = '46.7%',
NINETY_PERCENT = '88%',
INDEX_COMPONENT_WITH_PERCENT = '93.3%',
INDEX_SWIPER_HEIGHT_PERCENT = '24.1%',
INDEX_MODULE_HEIGHT_PERCENT = '22.8%',
INDEX_SWIPER_LEFT_RIGHT_MARGIN = '3.3%'
} | https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/common/constants/CommonConstants.ets#L91-L98 | 5d9e75aa19f0c2e712a4fb929522cac0f95181f7 | github | |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/TargetInfoApi.type.ets | arkts | 完成目标 | export interface TargetInfoCompleteParam {
/**
* 目标内容id
*/
id: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TargetInfoCompleteParam AST#object_type#Left { /**
* 目标内容id
*/ AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right ... | export interface TargetInfoCompleteParam {
id: number
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/TargetInfoApi.type.ets#L48-L54 | ee671a88d1c41863dcecf344316a68e2df8261fe | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/CustomContentBuilderProxy.ets | arkts | buttonOrientation | 按钮排列方式
@default 默认 水平排列 | buttonOrientation(buttonOrientation: Orientation) {
this.builderOptions.buttonOrientation = buttonOrientation;
return this;
} | AST#method_declaration#Left buttonOrientation AST#parameter_list#Left ( AST#parameter#Left buttonOrientation : AST#type_annotation#Left AST#primary_type#Left Orientation AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expr... | buttonOrientation(buttonOrientation: Orientation) {
this.builderOptions.buttonOrientation = buttonOrientation;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/CustomContentBuilderProxy.ets#L57-L60 | 52e7a2effff1d6c10fd7038b8dc571f30ab5b956 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/UserInfoRepository.ets | arkts | bindPhone | 绑定手机号
@param {Record<string, string>} params - 绑定参数
@returns {Promise<NetworkResponse<Unknown>>} 绑定结果 | async bindPhone(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.bindPhone(params);
} | AST#method_declaration#Left async bindPhone AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annota... | async bindPhone(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.bindPhone(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/UserInfoRepository.ets#L54-L56 | 5f48005b50da58d05bdcffe24d57e1b78e3416d9 | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/viewmodel/AccountList.ets | arkts | 定义支出列表 | export const PayList: Array<AccountClassification> = [
{
icon: $rawfile('foods.png'),
iconSelected: $rawfile('foods_selected.png'),
accountType: 0,
typeText: '吃饭'
},
{
icon: $rawfile('snacks.png'),
iconSelected: $rawfile('snacks_selected.png'),
accountType: 0,
typeText: '零食'
},
... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PayList : 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 AccountClassification AST#primary_type#Right AST#type_annotati... | export const PayList: Array<AccountClassification> = [
{
icon: $rawfile('foods.png'),
iconSelected: $rawfile('foods_selected.png'),
accountType: 0,
typeText: '吃饭'
},
{
icon: $rawfile('snacks.png'),
iconSelected: $rawfile('snacks_selected.png'),
accountType: 0,
typeText: '零食'
},
... | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/viewmodel/AccountList.ets#L7-L44 | 3cae6ca6d31ab4c9fd76b25e042e32091ac3d5b6 | github | |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | setLabelFormatter | 设置标签格式
@param formatter | setLabelFormatter(formatter: string) {
this.getInstance().setLabelFormatter(formatter)
this.invalidate()
} | AST#method_declaration#Left setLabelFormatter AST#parameter_list#Left ( AST#parameter#Left formatter : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#... | setLabelFormatter(formatter: string) {
this.getInstance().setLabelFormatter(formatter)
this.invalidate()
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L456-L459 | 6247e38c37c56bb607ba3caaaa0493b506f7cb39 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | buildHeader | 构建页面头部 | @Builder
buildHeader() {
AppHeader({
title: '生日日历',
showBack: false,
showAction: true,
actionText: this.showLunarCalendar ? '公历' : '农历',
onAction: () => {
this.toggleLunarCalendar();
}
})
} | 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: '生日日历',
showBack: false,
showAction: true,
actionText: this.showLunarCalendar ? '公历' : '农历',
onAction: () => {
this.toggleLunarCalendar();
}
})
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L200-L211 | a2b489b551c2cc1f1f3fcea91c3d88613de566ff | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/EntryOhos.ets | arkts | getX | Returns the x-value of this Entry object.
@return | public getX(): number {
return this.x;
} | AST#method_declaration#Left public getX 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#L... | public getX(): number {
return this.x;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/EntryOhos.ets#L38-L40 | 938975b38f3edf0618240a69119a2c0b6e5bce12 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | getAvatarUrl | 获取头像地址
@returns {ResourceStr} 头像地址 | getAvatarUrl(): ResourceStr {
return this.getUserInfo().avatarUrl;
} | AST#method_declaration#Left getAvatarUrl AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | getAvatarUrl(): ResourceStr {
return this.getUserInfo().avatarUrl;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L84-L86 | 7b9cffb06a6c5baa5a7667c3765d165a445209ef | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | decryptECBSync | 解密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|ECB|PKCS7、AES192|ECB|PKCS7、AES128|ECB|PKCS7)。
@returns | static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'AES256|ECB|PKCS7'): cryptoFramework.DataBlob {
return AES.decryptSync(data, symKey, null, transformation);
} | AST#method_declaration#Left static decryptECBSync 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 symKe... | static decryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = 'AES256|ECB|PKCS7'): cryptoFramework.DataBlob {
return AES.decryptSync(data, symKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L200-L203 | 4d254edbdcd61742079e0123f08f5694b5d90464 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets | arkts | joinTexts | / 合并字符串列表 | static joinTexts(list: Array<string> | null, seperator: string): string | null {
if (list === null) {
return null;
}
return list.join(seperator);
} | AST#method_declaration#Left static joinTexts AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right... | static joinTexts(list: Array<string> | null, seperator: string): string | null {
if (list === null) {
return null;
}
return list.join(seperator);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/StringDealUtilityForBaseWord.ets#L38-L43 | 27a47289b38ec6023d4b49e063621664e1015166 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | setBadgeFromNotificationCount | 设置桌面角标数量,来自于通知数量。 | static async setBadgeFromNotificationCount(): Promise<void> {
let count = await NotificationUtil.getActiveNotificationCount();
return notificationManager.setBadgeNumber(count); //设置角标
} | AST#method_declaration#Left static async setBadgeFromNotificationCount 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_annotat... | static async setBadgeFromNotificationCount(): Promise<void> {
let count = await NotificationUtil.getActiveNotificationCount();
return notificationManager.setBadgeNumber(count);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L344-L347 | d75d7e2f960005328352b982fc6adfe0fdb4a2fa | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Delete | Called when a deletion is made.
@since 7
@deprecated since 10 | static Delete(propName: string): boolean {
return AppStorage.delete(propName)
} | AST#method_declaration#Left static Delete AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | static Delete(propName: string): boolean {
return AppStorage.delete(propName)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L181-L183 | e0b2be879d141b9bd0cb5e7eadfd37ef1f6cd22f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | initialize | 初始化映射服务 | async initialize(): Promise<void> {
if (this.initialized) return;
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[LunarSolarMapping] Initializing mapping service...');
// 初始化当前年份和周边年份的映射数据
const currentYear = new Date().getFullYear();
const years = [currentYear - 1, c... | AST#method_declaration#Left async initialize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async initialize(): Promise<void> {
if (this.initialized) return;
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[LunarSolarMapping] Initializing mapping service...');
const currentYear = new Date().getFullYear();
const years = [currentYear - 1, currentYear, currentY... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L65-L85 | ac1205e91a144ca6978ff922c58414a55b84a518 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | createDefaultSyncConfig | 创建默认同步配置 | private createDefaultSyncConfig(): SyncConfig {
return {
enabled: false,
provider: SyncProvider.CUSTOM,
lastSyncTime: undefined,
autoSync: false,
syncInterval: 24
};
} | AST#method_declaration#Left private createDefaultSyncConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SyncConfig AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left... | private createDefaultSyncConfig(): SyncConfig {
return {
enabled: false,
provider: SyncProvider.CUSTOM,
lastSyncTime: undefined,
autoSync: false,
syncInterval: 24
};
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L629-L637 | aeba1a17cc70e59c2bd788c9f9f0368d45aee574 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseViewModel.ets | arkts | aboutToDisappear | 页面隐藏前
@returns {void} 无返回值 | aboutToDisappear(): void {
} | AST#method_declaration#Left aboutToDisappear 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#builder_function_body#Right AST#method_declaration#Right | aboutToDisappear(): void {
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseViewModel.ets#L18-L19 | dd17f87e0938a7511653422fef0df7d3497d8400 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets | arkts | initZip | 将项目目录rawfile下的压缩文件写入到应用的沙箱目录,用于后续介绍解压操作。 | initZip(rawfileZipName: string) {
// 使用getRowFileContent接口以字节数组的形式获取到rawfile中的文件内容。
this.context.resourceManager.getRawFileContent(rawfileZipName, (error: BusinessError, value: Uint8Array) => {
if (error) {
logger.error(TAG, `getRawFileContent failed, error message: ${error.message}, error code: $... | AST#method_declaration#Left initZip AST#parameter_list#Left ( AST#parameter#Left rawfileZipName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 使用getRowFileContent接口以字节数组的形式获取到rawf... | initZip(rawfileZipName: string) {
this.context.resourceManager.getRawFileContent(rawfileZipName, (error: BusinessError, value: Uint8Array) => {
if (error) {
logger.error(TAG, `getRawFileContent failed, error message: ${error.message}, error code: ${error.code}`);
} else {
const rawF... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/view/MainPage.ets#L88-L110 | 51421a69c4a9d0f3d1c3aa6e486b7428ce429100 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/browser.ets | arkts | 应用约束78:.ets文件import其他.ets文件 应用约束75:移除process.env和window相关的非标准库用法 应用约束9:使用const/let代替var(原代码已符合) 应用约束80:import语句放在文件顶部 | export default Discord; | AST#export_declaration#Left export default AST#expression#Left Discord AST#expression#Right ; AST#export_declaration#Right | export default Discord; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/browser.ets#L9-L9 | e01c12036db3295914aaca2b29daff5206b68010 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/auth/src/main/ets/navigation/AuthGraph.ets | arkts | @file 认证模块导航图
@author Joker.X | export class AuthGraph implements RouteGraph {
/**
* 注册认证模块导航路由
* @returns {void} 无返回值
*/
register(): void {
RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav));
}
} | AST#export_declaration#Left export AST#class_declaration#Left class AuthGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册认证模块导航路由
* @returns {void} 无返回值
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right :... | export class AuthGraph implements RouteGraph {
register(): void {
RouteBuild.register(AuthRoutes.Login, wrapBuilder(LoginNav));
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/navigation/AuthGraph.ets#L9-L17 | 4b97c46c01de7a4383e04a1b089f29ac9d3fb8e7 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | startMMS | 拉起短信界面并指定联系人
@param contactsName
@param telephone
@returns | static async startMMS(telephone: string, contactsName: string = ''): Promise<void> {
const want: Want = {
bundleName: 'com.ohos.mms',
abilityName: 'com.ohos.mms.MainAbility',
parameters: {
contactObjects: JSON.stringify([{
telephone: telephone,
contactsName: contactsNam... | AST#method_declaration#Left static async startMMS AST#parameter_list#Left ( AST#parameter#Left telephone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contactsName : AST#type_annotation#Left AST#primary_type#Left string ... | static async startMMS(telephone: string, contactsName: string = ''): Promise<void> {
const want: Want = {
bundleName: 'com.ohos.mms',
abilityName: 'com.ohos.mms.MainAbility',
parameters: {
contactObjects: JSON.stringify([{
telephone: telephone,
contactsName: contactsNam... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L238-L251 | 4a70c024ce0b53c16701dde2ef4484c4290aaa94 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ImageViewer/entry/src/main/ets/model/OffsetModel.ets | arkts | OffsetModel | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Observed
export class OffsetModel {
// 当前移动偏移量 X
public currentX: number;
// 当前移动偏移量 Y
public currentY: number;
// 最后的偏移量 X
public lastX: number = 0;
// 最后的偏移量 Y
public lastY: number = 0;
constructor(currentX: number = 0, currentY: number = 0) {
this.currentX = currentX;
this.currentY = curr... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class OffsetModel AST#class_body#Left { // 当前移动偏移量 X AST#property_declaration#Left public currentX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declar... | @Observed
export class OffsetModel {
public currentX: number;
public currentY: number;
public lastX: number = 0;
public lastY: number = 0;
constructor(currentX: number = 0, currentY: number = 0) {
this.currentX = currentX;
this.currentY = currentY;
}
reset(): void {
this.currentX... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/model/OffsetModel.ets#L16-L47 | e53db5ae4c40bca6de4d7e70ede1849de3f053e7 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | hide | 隐藏 Toast
@returns {void} 无返回值 | static hide(): void {
IBestToast.hide();
} | AST#method_declaration#Left static hide 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#L... | static hide(): void {
IBestToast.hide();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L142-L144 | a826bf9554069c337a4522b0b684c3eeb70c12ab | github |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/Constants.ets | arkts | 常量声明 | export const WEATHER_CONFIG: WeatherConfig = {
// 1. 确认Key:请使用控制台显示的“凭据ID”,通常是纯字母数字
API_KEY: 'fa950eb2e10d40e7bb837cc0bbc2bdfb',
// 2. 核心修改:将基础API域名改为你的个人API Host
BASE_URL: 'https://n94ewtd9t9.re.qweatherapi.com/v7/weather/now',
// 3. 同步修改:地理信息查询的域名也需要更换
CITY_URL: 'https://n94ewtd9t9.re.qweatherapi.com/v2/c... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left WEATHER_CONFIG : AST#type_annotation#Left AST#primary_type#Left WeatherConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { // 1. 确认Key:请使用控制台显示的“凭据ID”,通常是纯字母数字 AST#prop... | export const WEATHER_CONFIG: WeatherConfig = {
API_KEY: 'fa950eb2e10d40e7bb837cc0bbc2bdfb',
BASE_URL: 'https://n94ewtd9t9.re.qweatherapi.com/v7/weather/now',
CITY_URL: 'https://n94ewtd9t9.re.qweatherapi.com/v2/city/lookup'
}; | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/Constants.ets#L16-L23 | 1dd68d6548501b90058ac9f171069372894e7450 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieData.ets | arkts | getEntryForHighlight | @Override | public getEntryForHighlight(highlight: Highlight): EntryOhos {
return this.getDataSet().getEntryForIndex( /*(int) */
highlight.getX());
} | AST#method_declaration#Left public getEntryForHighlight AST#parameter_list#Left ( AST#parameter#Left highlight : AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Entry... | public getEntryForHighlight(highlight: Highlight): EntryOhos {
return this.getDataSet().getEntryForIndex(
highlight.getX());
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieData.ets#L99-L102 | 1127a56140eb95d53bab123309db8c4720f5cdfe | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/model/UserTableApi.ets | arkts | queryUserByUsername | Querying user information by user name.
@param username Querying user name.
@returns Query result set. | async queryUserByUsername(username: string): Promise<User[]> {
let resultList: Array<User>;
let predicates = new dataRdb.RdbPredicates(TABLE_NAME);
predicates.equalTo('username', username);
let ret = await this.userTable.query(predicates);
resultList = this.getListFromResultSet(ret);
return resu... | AST#method_declaration#Left async queryUserByUsername 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic... | async queryUserByUsername(username: string): Promise<User[]> {
let resultList: Array<User>;
let predicates = new dataRdb.RdbPredicates(TABLE_NAME);
predicates.equalTo('username', username);
let ret = await this.userTable.query(predicates);
resultList = this.getListFromResultSet(ret);
return resu... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/model/UserTableApi.ets#L44-L51 | c71dbff75ce2a8e92a0453052c8e7222cb57ccba | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | isToday | 判断是否为今天
@param date 要判断的日期
@returns 是否为今天 | static isToday(date: Date): boolean {
const today = new Date();
return date.toDateString() === today.toDateString();
} | AST#method_declaration#Left static isToday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig... | static isToday(date: Date): boolean {
const today = new Date();
return date.toDateString() === today.toDateString();
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L77-L80 | 82c358d9509cc31acc23c71d352d881f222d60a3 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.InterstitialDialogAction.d.ets | arkts | TitlePosition enumeration description.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare enum TitlePosition {
/**
* The main title is above the text content.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
TOP = 0,
/**
* The main title is below the text content.
*
* @syscap SystemCapability.ArkUI.ArkUI.Ful... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum TitlePosition AST#enum_body#Left { /**
* The main title is above the text content.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#enum_member#Left TOP... | export declare enum TitlePosition {
TOP = 0,
BOTTOM = 1
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.InterstitialDialogAction.d.ets#L56-L73 | 0b9023d3960fe5fa5baa7cca3aae4a20011178c8 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets | arkts | getRouter | 通过名称获取router | public static getRouter(routerName: string): NavPathStack{
let router = RouterModule.routerMap.get(routerName);
return router as NavPathStack;
} | AST#method_declaration#Left public static getRouter AST#parameter_list#Left ( AST#parameter#Left routerName : 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 NavPathStac... | public static getRouter(routerName: string): NavPathStack{
let router = RouterModule.routerMap.get(routerName);
return router as NavPathStack;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L36-L39 | 03678588242fdea8886b080824115dc0fdf80c39 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/routermodule/src/main/ets/interceptor/Interceptor.ets | arkts | interceptor | 公共拦截器逻辑
@param appUri 接收传过来的路由名
@param param 路由参数 | public static interceptor(appUri: string, param?: string): boolean {
// 循环拦截器容器中所有的子模块自定义的拦截函数
for (let i = 0; i < Interceptor.list.length; i++) {
if (Interceptor.list[i].executeFunction(appUri, param))
return true; // 如果子模块拦截函数返回true,即需要拦截
}
// 否则就放行
return false;
} | AST#method_declaration#Left public static interceptor AST#parameter_list#Left ( AST#parameter#Left appUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left string AST#... | public static interceptor(appUri: string, param?: string): boolean {
for (let i = 0; i < Interceptor.list.length; i++) {
if (Interceptor.list[i].executeFunction(appUri, param))
return true;
}
return false;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/interceptor/Interceptor.ets#L61-L69 | 5d28b90ad8a487bba1199bcd7bdbf7c62dbe46ba | gitee |
batiluoxuanwan/MomentFlow.git | e57aa461223abca74f48893afc2ccf7c2d73e9b8 | frontend/entry/src/main/ets/api/DiaryApi.ets | arkts | getList | 获取指定用户的日记列表 | static async getList(userId: number): Promise<Diary[]> {
const res = await request<Diary[]>(`${BASE_URL}/user/${userId}`, {
method: http.RequestMethod.GET
})
return res ?? []
} | AST#method_declaration#Left static async getList AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | static async getList(userId: number): Promise<Diary[]> {
const res = await request<Diary[]>(`${BASE_URL}/user/${userId}`, {
method: http.RequestMethod.GET
})
return res ?? []
} | https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/api/DiaryApi.ets#L53-L58 | a26ec4eef9700ed6768ec095baee823d02329d8b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 字体大小枚举 | export enum FontSize {
SMALL = 'small',
MEDIUM = 'medium',
LARGE = 'large',
EXTRA_LARGE = 'extra_large'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum FontSize AST#enum_body#Left { AST#enum_member#Left SMALL = AST#expression#Left 'small' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MEDIUM = AST#expression#Left 'medium' AST#expression#Right AST#enum_member#Right , AST#enum_member#Le... | export enum FontSize {
SMALL = 'small',
MEDIUM = 'medium',
LARGE = 'large',
EXTRA_LARGE = 'extra_large'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L541-L546 | 71f99d618adc9d8ea1250a963bdc607e4ce26d27 | github | |
nutsus/nut-jokes | 1dc09db3e87922ae4a8edb59017b63ddbe899f40 | entry/src/main/ets/MainAbility/pages/Main.ets | arkts | getRequest | 请求方式:GET | getRequest() {
// 每一个httpRequest对应一个http请求任务,不可复用
let httpRequest = http.createHttp()
let url = 'http://v.juhe.cn/joke/content/list.php?key=abfc762a7d39b68b38e52b9f69c1d6de&page=2&pagesize=10&sort=adescsc&time=1658454615'
httpRequest.request(url, (err, data) => {
if (!err) {
if (data.respo... | AST#method_declaration#Left getRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 每一个httpRequest对应一个http请求任务,不可复用 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#m... | getRequest() {
let httpRequest = http.createHttp()
let url = 'http://v.juhe.cn/joke/content/list.php?key=abfc762a7d39b68b38e52b9f69c1d6de&page=2&pagesize=10&sort=adescsc&time=1658454615'
httpRequest.request(url, (err, data) => {
if (!err) {
if (data.responseCode == 200) {
consol... | https://github.com/nutsus/nut-jokes/blob/1dc09db3e87922ae4a8edb59017b63ddbe899f40/entry/src/main/ets/MainAbility/pages/Main.ets#L109-L147 | d9fb6e0e79845d7c9ce59cb4663bd5bbd7a8c694 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/UserState.ets | arkts | getUserInfo | 获取当前用户信息
@returns {User} 用户信息,未登录返回空对象 | getUserInfo(): User {
return this.userInfo;
} | AST#method_declaration#Left getUserInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left User 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#Lef... | getUserInfo(): User {
return this.userInfo;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L130-L132 | c270f939fed6aee85cb396005e98fbf65f1b7b23 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setMinAngleForSlices | Set the angle to set minimum size for slices, you must call {@link #notifyDataSetChanged()}
and {@link #invalidate()} when changing this, only works if there is enough room for all
slices to have the minimum angle.
@param minAngle minimum 0, maximum is half of {@link #setMaxAngle(float)} | public setMinAngleForSlices(minAngle: number): void {
if (minAngle > (this.mMaxAngle / 2))
minAngle = this.mMaxAngle / 2;
else if (minAngle < 0)
minAngle = 0;
this.mMinAngleForSlices = minAngle;
} | AST#method_declaration#Left public setMinAngleForSlices AST#parameter_list#Left ( AST#parameter#Left minAngle : 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#... | public setMinAngleForSlices(minAngle: number): void {
if (minAngle > (this.mMaxAngle / 2))
minAngle = this.mMaxAngle / 2;
else if (minAngle < 0)
minAngle = 0;
this.mMinAngleForSlices = minAngle;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L840-L848 | 2226ce01497fc81e1d0db4875a0657f8e82de0ec | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets | arkts | notifyDataChange | 通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件。
@param {number} index - 索引值。 | notifyDataChange(index: number): void {
this.listeners.forEach(listener => {
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 => {
listener.onDataChange(index);
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L86-L90 | 8f3a6ba72d3960aa7e1d6c3e40832f6a1323af2f | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/common/promptShow.ets | arkts | 自定义提示
@param message | export function showMessage(message:string ,showDuration:number = 1000){
promptAction.showToast({
message: message,
duration: showDuration,
})
} | AST#export_declaration#Left export AST#function_declaration#Left function showMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left showDuration : AST#type_annotation#... | export function showMessage(message:string ,showDuration:number = 1000){
promptAction.showToast({
message: message,
duration: showDuration,
})
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/common/promptShow.ets#L7-L12 | b2bc8f6d0e0a520229438b89e94a355e12ea714c | github | |
FantasyWind/fwrouter | eea785a7bf728862de1f88de487ef3857dee3364 | libraryHarDemo/Index.ets | arkts | DemoPage | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { DemoPage } from './src/main/ets/pages/DemoPage' | AST#export_declaration#Left export { DemoPage } from './src/main/ets/pages/DemoPage' AST#export_declaration#Right | export { DemoPage } from './src/main/ets/pages/DemoPage' | https://github.com/FantasyWind/fwrouter/blob/eea785a7bf728862de1f88de487ef3857dee3364/libraryHarDemo/Index.ets#L15-L15 | c94e55dafab6835256d2329e17aa06f7106c0a58 | gitee |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/player/WLPlayer.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2025/4/26 16:47
@Version V1.0
@Description wlmedia | export class WLPlayer extends AbstractPlayer {
private readonly wlPlayer: WlPlayer
private readonly rgba: string = '#000000FF';
private readonly uniqueNum: number = 0
private prepared: boolean = false
private videoWidth?: number
private videoHeight?: number
private count = 0
public static genera... | AST#export_declaration#Left export AST#class_declaration#Left class WLPlayer extends AST#type_annotation#Left AST#primary_type#Left AbstractPlayer AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private readonly wlPlayer : AST#type_annotation#Left AST#primary_type#Le... | export class WLPlayer extends AbstractPlayer {
private readonly wlPlayer: WlPlayer
private readonly rgba: string = '#000000FF';
private readonly uniqueNum: number = 0
private prepared: boolean = false
private videoWidth?: number
private videoHeight?: number
private count = 0
public static genera... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/player/WLPlayer.ets#L18-L273 | e4ee7d85e8614e91bd4c371464c89beaf43628f4 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets | arkts | this | 获取视频总长 | this.avPlayer.play(); | AST#method_declaration#Left this AST#ERROR#Left . avPlayer . play AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right | this.avPlayer.play(); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/AVPlayer.ets#L218-L218 | f172a7d1e459becb8d39a4244e8f220ec3a4b1f3 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | getFirstCartGoodsId | 获取购物车第一件商品 ID
@returns {number} 商品 ID | private getFirstCartGoodsId(): number {
const cart: Cart | undefined = this.cartList[0];
return cart?.goodsId ?? 0;
} | AST#method_declaration#Left private getFirstCartGoodsId 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#... | private getFirstCartGoodsId(): number {
const cart: Cart | undefined = this.cartList[0];
return cart?.goodsId ?? 0;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L352-L355 | 2be026fb46055fbae37748d8e336e6062407fe2f | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/ToastTipOptions.ets | arkts | TODO ToastTip基本参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export interface ToastTipOptions extends BaseDialogOptions {
message?: string | Resource; //吐司内容
duration?: number; //显示时长(1500ms-10000ms)
fontSize?: number | string | Resource; //文字大小
fontColor?: ResourceColor; //文字颜色
backgroundColor?: ResourceColor; //背景颜色,建议八位色值前两位为透明度
borderRadius?: Length | BorderRadi... | AST#export_declaration#Left export AST#interface_declaration#Left interface ToastTipOptions AST#extends_clause#Left extends BaseDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left message ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right ... | export interface ToastTipOptions extends BaseDialogOptions {
message?: string | Resource;
duration?: number;
fontSize?: number | string | Resource;
fontColor?: ResourceColor;
backgroundColor?: ResourceColor;
borderRadius?: Length | BorderRadiuses;
padding?: Padding | Length;
imageRes: ResourceS... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/ToastTipOptions.ets#L24-L39 | 289cbdbced7a61c357b04139a2e3bf837808e2ad | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/model/DataModel.ets | arkts | 定义更多服务类 | export interface IconListType {
name: string,
icon: Resource
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IconListType AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left icon : AST#type_annotation#Left ... | export interface IconListType {
name: string,
icon: Resource
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/model/DataModel.ets#L23-L26 | 9ea420e7f4797efe01ae16b56d2a7a471046a775 | gitee | |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/utils.ets | arkts | 编码 | export function encodeStr(str: string) {
const text = encodeURIComponent(str)
return text
} | AST#export_declaration#Left export AST#function_declaration#Left function encodeStr AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#stat... | export function encodeStr(str: string) {
const text = encodeURIComponent(str)
return text
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/utils.ets#L99-L102 | d645a984c5351c258b49804b6e75bab1e46d5b91 | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/style/ToastSpecifyOptions.ets | arkts | Toast吐司特殊配置 | export class ToastSpecifyOptions {
// style: ToastStyle = new ToastStyle()
style: ToastIconStyle = new ToastIconStyle()
} | AST#export_declaration#Left export AST#class_declaration#Left class ToastSpecifyOptions AST#class_body#Left { // style: ToastStyle = new ToastStyle() AST#property_declaration#Left style : AST#type_annotation#Left AST#primary_type#Left ToastIconStyle AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left... | export class ToastSpecifyOptions {
style: ToastIconStyle = new ToastIconStyle()
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/ToastSpecifyOptions.ets#L6-L9 | 7e26d714ca980f4825cb013d42f4b1651498539c | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/guide/GuideService.ets | arkts | clearBadge | 清除角标 | async clearBadge(key: string): Promise<void> {
try {
const badgeKey = `${this.BADGE_PREFIX}${key}`;
await StorageManager.remove(badgeKey);
Logger.info('GuideService', `Badge cleared: ${key}`);
} catch (error) {
Logger.error('GuideService', `Failed to clear badge: ${String(error)}`);
... | AST#method_declaration#Left async clearBadge AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pro... | async clearBadge(key: string): Promise<void> {
try {
const badgeKey = `${this.BADGE_PREFIX}${key}`;
await StorageManager.remove(badgeKey);
Logger.info('GuideService', `Badge cleared: ${key}`);
} catch (error) {
Logger.error('GuideService', `Failed to clear badge: ${String(error)}`);
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L143-L151 | 20a18385fda01f23955962bbf209e5e512f670e7 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Chip.d.ets | arkts | Enum for AccessibilitySelectedType
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 14 | export declare enum AccessibilitySelectedType {
/**
* Default type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
CLICKED = 0,
/**
* Checked type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum AccessibilitySelectedType AST#enum_body#Left { /**
* Default type.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/ AST#enum_member#Left CLICKED = A... | export declare enum AccessibilitySelectedType {
CLICKED = 0,
CHECKED = 1,
SELECTED = 2
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L90-L120 | d8a2e8657568aef32ec56ad455d1f1d7f4fda7ad | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | PickerOptions Object
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare class PickerOptions extends photoAccessHelper.BaseSelectOptions {
/**
* Support set checkBox color
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
checkBoxColor?: string;
/**
* Suppo... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class PickerOptions extends AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . BaseSelectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#clas... | export declare class PickerOptions extends photoAccessHelper.BaseSelectOptions {
checkBoxColor?: string;
backgroundColor?: string;
isRepeatSelectSupported?: boolean;
checkboxTextColor?: string;
photoBrowserBackgroundColorMode?: PickerColorMode;
maxSelectedReminderMo... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L241-L353 | f505da9e245ebd3b3370b19f2aaafd56c99d8d80 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets | arkts | arrNeedSplit | 判断数组是否需要截取
@param arr 判断的数组
@param str 源字符串
@param keyLen 编码长度
@returns | static arrNeedSplit(arr: Uint8Array, str: string, keyLen: number): Uint8Array {
if (arr.length != keyLen / 8) {
//需要截取
const hexString = str.match(/.{1,2}/g); // 将字符串按每两个字符分割为数组
let arr = new Array<string>();
hexString?.forEach((val) => {
arr.push(val);
})
let byteArray: ... | AST#method_declaration#Left static arrNeedSplit AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | static arrNeedSplit(arr: Uint8Array, str: string, keyLen: number): Uint8Array {
if (arr.length != keyLen / 8) {
const hexString = str.match(/.{1,2}/g);
let arr = new Array<string>();
hexString?.forEach((val) => {
arr.push(val);
})
let byteArray: number[] = arr.map(byte ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L159-L178 | 0d9e6976870481b32d2f4d553234c4550d81184d | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets | arkts | aboutToAppear | Call back when the NodeContainer corresponding to the controller is in Appear. | aboutToAppear(): void {
console.log('aboutToAppear')
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
console.log('aboutToAppear')
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets#L74-L76 | 794eae245079156c603fe3b7995c91d5cf9d3ef7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_asynchronous.ets | arkts | encryptMessagePromise | 加密消息 | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|CBC|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, iv);
let encryptData = await cipher.doFinal(plainText);
return encryptDat... | AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|CBC|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, iv);
let encryptData = await cipher.doFinal(plainText);
return encryptDat... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_cbc_encryption_decryption/sm4_cbc_encryption_decryption_asynchronous.ets#L38-L43 | 2bc4d431e1818a13eddda2675e1171c4d02f134f | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.inputMethodList.d.ets | arkts | Define pattern of keyboard. The caller must be the current inputmethod.
@interface Pattern
@syscap SystemCapability.MiscServices.InputMethodFramework
@since 11 | export interface Pattern {
/**
* The icon resource of pattern.
*
* @type { Resource }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/
icon: Resource;
/**
* The selected icon resource of pattern.
*
* @type { Resource }
* @syscap SystemCapability.MiscService... | AST#export_declaration#Left export AST#interface_declaration#Left interface Pattern AST#object_type#Left { /**
* The icon resource of pattern.
*
* @type { Resource }
* @syscap SystemCapability.MiscServices.InputMethodFramework
* @since 11
*/ AST#type_member#Left icon : AST#type_annotation#Left AST#pri... | export interface Pattern {
icon: Resource;
selectedIcon: Resource;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.inputMethodList.d.ets#L62-L79 | 5f148902db4d949d012ee74d729e81ab9121a29a | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | stat | 获取文件详细属性信息,使用Promise异步回调。
@param file string|number 文件应用沙箱路径path或已打开的文件描述符fd。 | static stat(file: string | number): Promise<fs.Stat> {
return fs.stat(file);
} | AST#method_declaration#Left static stat AST#parameter_list#Left ( AST#parameter#Left file : 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#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#para... | static stat(file: string | number): Promise<fs.Stat> {
return fs.stat(file);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L564-L566 | d16a1f771c0b8ca4c412c929cf1953892cb5200b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/game/VirtualShopPage.ets | arkts | buildCurrencyBar | 构建货币状态栏 | @Builder
buildCurrencyBar() {
Row({ space: 16 }) {
// 银币
this.buildCurrencyItem(
CurrencyType.SILVER_COIN,
this.wallet?.balances.get(CurrencyType.SILVER_COIN) || 0,
'#C0C0C0',
'ic_silver_coin'
)
// 金币
this.buildCurrencyItem(
CurrencyType... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCurrencyBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_param... | @Builder
buildCurrencyBar() {
Row({ space: 16 }) {
this.buildCurrencyItem(
CurrencyType.SILVER_COIN,
this.wallet?.balances.get(CurrencyType.SILVER_COIN) || 0,
'#C0C0C0',
'ic_silver_coin'
)
this.buildCurrencyItem(
CurrencyType.GOLD_COIN... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/game/VirtualShopPage.ets#L129-L182 | d0c2e5b5dae3c2db2d9ea20178f6e17d9f91ba91 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/viewmodels/ReviewViewModel.ets | arkts | getEfficiencyColor | 获取效率颜色 | static getEfficiencyColor(task: TaskItem): ResourceColor {
if (!task.actualTime) return '#999999';
const ratio = task.estimatedTime / task.actualTime;
if (ratio >= 0.9 && ratio <= 1.1) return '#34C759'; // 绿色:高效
if (ratio < 0.9) return '#FF9500'; // 橙色:超时
return '#007DFF'; // 蓝色:提前完成
} | AST#method_declaration#Left static getEfficiencyColor AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceColor... | static getEfficiencyColor(task: TaskItem): ResourceColor {
if (!task.actualTime) return '#999999';
const ratio = task.estimatedTime / task.actualTime;
if (ratio >= 0.9 && ratio <= 1.1) return '#34C759';
if (ratio < 0.9) return '#FF9500';
return '#007DFF';
} | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L153-L159 | 34581a86d46e6558ff836c3fb3dbd52b5f192204 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets | arkts | getInstance | 获取对象函数
@returns | public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
} | AST#method_declaration#Left public static getInstance 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left ChatConfig... | public static getInstance() {
if (!ChatConfig._instance) {
ChatConfig._instance = new ChatConfig();
}
return ChatConfig._instance
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets#L27-L32 | 5e63e1c980f6d2db0e1944c59145c20d487a8436 | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/ClockArea.ets | arkts | drawTime | 绘制完整时间回显。
@param hour 当前的小时数。
@param minute 当前的分钟数。
@param second 当前的秒数。 | private drawTime(hour: number, minute: number, second: number): void {
let time = (hour > 9 ? hour : ('0' + hour)) + ':'
+ (minute > 9 ? minute : ('0' + minute)) + ':'
+ (second > 9 ? second : ('0' + second));
this.renderContext.save();
this.renderContext.font = DimensionUtil.getPx($r('app.float.clo... | AST#method_declaration#Left private drawTime AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minute : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | private drawTime(hour: number, minute: number, second: number): void {
let time = (hour > 9 ? hour : ('0' + hour)) + ':'
+ (minute > 9 ? minute : ('0' + minute)) + ':'
+ (second > 9 ? second : ('0' + second));
this.renderContext.save();
this.renderContext.font = DimensionUtil.getPx($r('app.float.clo... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ClockArea.ets#L154-L165 | ef342fdb1bf5a2ef0bdcbcfaee4dac040922b4fa | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets | arkts | AES加密
@param textString 需要加密的数据
@param aesKey AES密钥
@returns | export async function aesGcmEncrypt(textString: string, aesKey: string): Promise<string> {
try {
// 创建对称密钥生成器实例
let symKeyGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AES256');
// 将AES密钥字符串转换为密钥类型
let symKeyBlob: cryptoFramework.DataBlob = { data: fromHexString(a... | AST#export_declaration#Left export AST#function_declaration#Left async function aesGcmEncrypt AST#parameter_list#Left ( AST#parameter#Left textString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annota... | export async function aesGcmEncrypt(textString: string, aesKey: string): Promise<string> {
try {
let symKeyGenerator: cryptoFramework.SymKeyGenerator = cryptoFramework.createSymKeyGenerator('AES256');
let symKeyBlob: cryptoFramework.DataBlob = { data: fromHexString(aesKey) };
let key: cryptoFram... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets#L92-L130 | 1ef80c694e67084b1c94c087ee81857e3ec44a6d | gitee | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/common/constants/ZonesConstants.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class ZonesConstants {
static readonly ITEM_WIDTH: number = 86;
static readonly SHOW_COUNT: number = 5;
static readonly HALF_COUNT: number = Math.floor(ZonesConstants.SHOW_COUNT / 2);
static readonly OPACITY_COEFFICIENTS: number = 0.1;
static readonly OFFSET_COEFFICIENTS: number = 10;
static readonly... | AST#export_declaration#Left export AST#class_declaration#Left class ZonesConstants AST#class_body#Left { AST#property_declaration#Left static readonly ITEM_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 86 AST#expression#Right ; AST#p... | export class ZonesConstants {
static readonly ITEM_WIDTH: number = 86;
static readonly SHOW_COUNT: number = 5;
static readonly HALF_COUNT: number = Math.floor(ZonesConstants.SHOW_COUNT / 2);
static readonly OPACITY_COEFFICIENTS: number = 0.1;
static readonly OFFSET_COEFFICIENTS: number = 10;
static readonly... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/constants/ZonesConstants.ets#L16-L24 | 852bea896925d58dfb6556c2a41813e75f709509 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/TlsDemo/entry/src/main/ets/pages/Index.ets | arkts | selectCA | 选择CA证书文件 | selectCA() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
caFileUri = result[0]
this.msgHistory += "select file: " + caFileUri + "\r\n";
this.canLoad = true
}
}).catch((e) => {
this.msgHist... | AST#method_declaration#Left selectCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi... | selectCA() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
caFileUri = result[0]
this.msgHistory += "select file: " + caFileUri + "\r\n";
this.canLoad = true
}
}).catch((e) => {
this.msgHist... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/TlsDemo/entry/src/main/ets/pages/Index.ets#L215-L226 | bf575dbecc305961bc29c03aa5274e893a589099 | gitee |
ni202383/Chenguang-Calendar.git | c04543db2c394d662bc1336d098335134ff1e9a5 | entry/src/main/ets/pages/View/MonthViewDetail.ets | arkts | getLunarOrSolorItemOrFestival | 更新当前选中的本月的那一天 | getLunarOrSolorItemOrFestival(dailyInfo: DailyInfo): string {
if (dailyInfo.getFestival().length > 0) {
return dailyInfo.getFestival()[0];
} else if (dailyInfo.getSolarTerm() != '') {
return dailyInfo.getSolarTerm();
} else {
return dailyInfo.getLunarDateText();
}
} | AST#method_declaration#Left getLunarOrSolorItemOrFestival AST#parameter_list#Left ( AST#parameter#Left dailyInfo : AST#type_annotation#Left AST#primary_type#Left DailyInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left str... | getLunarOrSolorItemOrFestival(dailyInfo: DailyInfo): string {
if (dailyInfo.getFestival().length > 0) {
return dailyInfo.getFestival()[0];
} else if (dailyInfo.getSolarTerm() != '') {
return dailyInfo.getSolarTerm();
} else {
return dailyInfo.getLunarDateText();
}
} | https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/entry/src/main/ets/pages/View/MonthViewDetail.ets#L139-L147 | b61894d02b6265953db0c427c200d2b6f4bac8b9 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/WindowModel.ets | arkts | setImmersive | 当前主窗口是否开启沉浸模式
@returns {void} | setImmersive(popPage?: () => void) {
if (this.windowStage === undefined) {
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
return;
}
try {
// 设置沉浸式全屏
windowClass.setWindowLayoutFullScreen(true)
.then(... | AST#method_declaration#Left setImmersive AST#parameter_list#Left ( AST#parameter#Left popPage ? : AST#type_annotation#Left AST#function_type#Left 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#function_type... | setImmersive(popPage?: () => void) {
if (this.windowStage === undefined) {
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
return;
}
try {
windowClass.setWindowLayoutFullScreen(true)
.then(() => {
... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/WindowModel.ets#L112-L133 | 3f3514e083c89bc7f45c2df2611a33d1754f27f2 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoHelper.ets | arkts | strToDataBlob | 字符串转DataBlob
@param str 字符串
@param coding 编码方式(base64/hex/utf8/utf-8)。
@returns | static strToDataBlob(str: string, coding: crypto.BhuCoding): cryptoFramework.DataBlob {
let dataBlob: cryptoFramework.DataBlob = { data: CryptoHelper.strToUint8Array(str, coding) };
return dataBlob;
} | AST#method_declaration#Left static strToDataBlob AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left coding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#L... | static strToDataBlob(str: string, coding: crypto.BhuCoding): cryptoFramework.DataBlob {
let dataBlob: cryptoFramework.DataBlob = { data: CryptoHelper.strToUint8Array(str, coding) };
return dataBlob;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L38-L41 | cea425d5c5038040d95f42160479bf2449329db3 | gitee |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/pages/music/ProfilePage.ets | arkts | logout | 退出登录 | async logout(): Promise<void> {
try {
this.isLoading = true;
await this.userService.signOut();
this.isLoggedIn = false;
this.userInfo = new UserInfo(0, '游客', '');
prompt.showToast({ message: '已退出登录' });
} catch (error) {
console.error('退出登录失败:', error);
prompt.showToast... | AST#method_declaration#Left async logout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments... | async logout(): Promise<void> {
try {
this.isLoading = true;
await this.userService.signOut();
this.isLoggedIn = false;
this.userInfo = new UserInfo(0, '游客', '');
prompt.showToast({ message: '已退出登录' });
} catch (error) {
console.error('退出登录失败:', error);
prompt.showToast... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/music/ProfilePage.ets#L95-L108 | e5a4e3776df19cfc8ccbb5822e64379b2870a016 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | aboutToAppear | 页面生命周期 - 即将出现 | aboutToAppear() {
// 获取路由参数
const params = appRouter.getCurrentParams();
const paramsRecord = params as Record<string, string>;
this.contactId = paramsRecord.contactId;
if (this.contactId) {
this.loadContactDetail();
} else {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取路由参数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST... | aboutToAppear() {
const params = appRouter.getCurrentParams();
const paramsRecord = params as Record<string, string>;
this.contactId = paramsRecord.contactId;
if (this.contactId) {
this.loadContactDetail();
} else {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Co... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactDetailPage.ets#L38-L50 | c9df02ed1cfdd599ddf8d54ba1c3944ba263313d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets | arkts | getFontColor | 获取省、市、区名需要显示的字体颜色
@param addressType 省/市/区类型
@param item 省、市、区地址项
@returns 需要显示的字体颜色 | getFontColor(addressType: AddressType, item: CommonAddressList): Color | string | Resource {
// 省/市/区名字体颜色
let isSelect: boolean = false;
if (addressType === AddressType.Province) {
isSelect = this.currentSelectInfo.province !== '' && item.name === this.currentSelectInfo.province;
} else if (addre... | AST#method_declaration#Left getFontColor AST#parameter_list#Left ( AST#parameter#Left addressType : AST#type_annotation#Left AST#primary_type#Left AddressType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CommonAddressList... | getFontColor(addressType: AddressType, item: CommonAddressList): Color | string | Resource {
let isSelect: boolean = false;
if (addressType === AddressType.Province) {
isSelect = this.currentSelectInfo.province !== '' && item.name === this.currentSelectInfo.province;
} else if (addressType === Ad... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets#L181-L192 | 378acb8cf43ace32bfce87cef7e313c02c74486a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Encode.ets | arkts | 图片编码,通过imageSource将图片直接打包成文件保存。
@param pixelMap - 位图操作对象。
@param isHdr - 是否为HDR格式。 | export async function encodeToFileByImageSource(imageSource:image.ImageSource,isHdr:boolean) {
let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 98 };
if(isHdr == true) {
packOpts.desiredDynamicRange = image.PackingDynamicRange.AUTO;
}
// [Start pixelmap_encoding_into_file_through_image_s... | AST#export_declaration#Left export AST#function_declaration#Left async function encodeToFileByImageSource AST#parameter_list#Left ( AST#parameter#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right AST#type_annotat... | export async function encodeToFileByImageSource(imageSource:image.ImageSource,isHdr:boolean) {
let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 98 };
if(isHdr == true) {
packOpts.desiredDynamicRange = image.PackingDynamicRange.AUTO;
}
const filePath : string = context.cacheDir + '/ima... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Encode.ets#L116-L133 | 2964f41eb103daaa6129d28499880c915caa4e0f | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_asynchronous.ets | arkts | encryptMessageUpdateBySegment | 分段加密消息 | async function encryptMessageUpdateBySegment(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let updateLength = 20; // 假设以20字节为单位进行分段update,实际并无要求
... | AST#function_declaration#Left async function encryptMessageUpdateBySegment AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ,... | async function encryptMessageUpdateBySegment(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams);
let updateLength = 20;
let cipherText = new Uint8Arr... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_asynchronous.ets#L48... | be20afc514a64b8cfcdad67b4d518b2c84f3caa6 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/argument_passing/argument_passing_002_F.ets | arkts | Introduction 参数传递-普通参数传递 | export function argument_passing_002_F(taint_src : string) {
let _t = taint_src
let _clean = "clean"
f(_clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function argument_passing_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem... | export function argument_passing_002_F(taint_src : string) {
let _t = taint_src
let _clean = "clean"
f(_clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/argument_passing/argument_passing_002_F.ets#L6-L10 | 1738b6e1fcf2f38c0afd101fa5a0553b863c2352 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/AudioCapturerHelper.ets | arkts | onReadDataCallback | 监听音频数据读取回调事件(当需要读取音频流数据时触发),使用callback方式返回结果.
@param filePath 文件全路径
@returns | static onReadDataCallback(filePath: string) {
let bufferSize: number = 0;
AudioCapturerHelper.file = Helper.openSync(filePath);
let readDataCallback: Callback<ArrayBuffer> = (buffer: ArrayBuffer) => {
Helper.writeSync(AudioCapturerHelper.file!.fd, buffer, { offset: bufferSize, length: buffer.byteLengt... | AST#method_declaration#Left static onReadDataCallback AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_d... | static onReadDataCallback(filePath: string) {
let bufferSize: number = 0;
AudioCapturerHelper.file = Helper.openSync(filePath);
let readDataCallback: Callback<ArrayBuffer> = (buffer: ArrayBuffer) => {
Helper.writeSync(AudioCapturerHelper.file!.fd, buffer, { offset: bufferSize, length: buffer.byteLengt... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/AudioCapturerHelper.ets#L76-L85 | b798fd34934c2c198bb3f9b8f24935213d8c97c8 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/ui/animation/AnimationUtils.ets | arkts | slide | 滑动转场配置 | static slide(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
} | AST#method_declaration#Left static slide AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PageTransitionConfig AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#obje... | static slide(): PageTransitionConfig {
return {
duration: 300,
curve: curve.EaseOut
};
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/animation/AnimationUtils.ets#L95-L100 | 450a4d64e08c52e35610665bd5ee45342528e97f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | playNotificationSound | 播放通知声音 | private async playNotificationSound(): Promise<void> {
try {
console.log('[Settings] Playing notification sound...');
// 使用系统API播放通知声音
// 在真实设备上,可以使用AudioManager播放系统音效
promptAction.showToast({
message: '🔊 播放提示音',
duration: 1000
});
console.log('[Settings] Notif... | AST#method_declaration#Left private async playNotificationSound 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#Rig... | private async playNotificationSound(): Promise<void> {
try {
console.log('[Settings] Playing notification sound...');
promptAction.showToast({
message: '🔊 播放提示音',
duration: 1000
});
console.log('[Settings] Notification sound played successfully');
} catch... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L1229-L1244 | 32393edd622a050718213786ea8044d40c149bb2 | github |
anhao0226/harmony-music-player.git | 4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073 | entry/src/main/ets/view_models/LyricModel.ets | arkts | fromJson | klyric: KlyricModel; tlyric: TlyricModel; romalrc: RomalrcModel; | fromJson(json: any) {
this.sgc = json['sgc'];
this.sfy = json['sfy'];
this.qfy = json['qfy'];
//
// if (json['transUser'] !== null) {
// this.transUser = new TransUserModel().fromJson(json['transUser']);
// }
//
// if (json['lyricUser'] !== null) {
// this.lyricUser = new Lyr... | AST#method_declaration#Left fromJson AST#parameter_list#Left ( AST#parameter#Left json : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left A... | fromJson(json: any) {
this.sgc = json['sgc'];
this.sfy = json['sfy'];
this.qfy = json['qfy'];
if (json['transUser'] !== null) {
this.transUser = new TransUserModel().fromJson(json['transUser']);
}
if (json['lyricUser'] !== null) {
this.lyricUser = new LyricUserModel().... | https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/LyricModel.ets#L96-L125 | 2ab19d1bddb96aa30649b78ce29f38a7c0317c6c | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/http/FileUtil.ets | arkts | hasDirPath | 判断是否是完整路径
@param path 文件路径 | static hasDirPath(path: string): boolean {
return StringUtils.startsWith(path, "/data/storage/") || StringUtils.startsWith(path, "/storage/");
} | AST#method_declaration#Left static hasDirPath AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | static hasDirPath(path: string): boolean {
return StringUtils.startsWith(path, "/data/storage/") || StringUtils.startsWith(path, "/storage/");
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/FileUtil.ets#L112-L114 | bad73a3312f6b6fef5ab7ed2d59d0f8ebc304278 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/DataSet.ets | arkts | Determines how to round DataSet index values for
{@link DataSet#getEntryIndex(float, float, Rounding)} DataSet.getEntryIndex()}
when an exact x-index is not found. | export enum Rounding {
UP,
DOWN,
CLOSEST,
} | AST#export_declaration#Left export AST#enum_declaration#Left enum Rounding AST#enum_body#Left { AST#enum_member#Left UP AST#enum_member#Right , AST#enum_member#Left DOWN AST#enum_member#Right , AST#enum_member#Left CLOSEST AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#R... | export enum Rounding {
UP,
DOWN,
CLOSEST,
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/DataSet.ets#L446-L450 | 5219a1237eb08269e8a129b9b0658727741b1b22 | gitee | |
dloong49/wallpaper-app.git | ef84f33ba56fbe333c50c0de59ae56d28f556c0b | entry/src/main/ets/component/ToLoad.ets | arkts | 上拉加载 | build() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Image($r("app.media.loading")).width(40).height(40)
Text("加载中...").fontSize(13)
}.height(50).width("100%")
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right ... | build() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Image($r("app.media.loading")).width(40).height(40)
Text("加载中...").fontSize(13)
}.height(50).width("100%")
} | https://github.com/dloong49/wallpaper-app.git/blob/ef84f33ba56fbe333c50c0de59ae56d28f556c0b/entry/src/main/ets/component/ToLoad.ets#L5-L10 | 2a4eabc1026825a0c0bf163b360665f14e7d31e0 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/textexpand/Index.ets | arkts | TextExpand | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { TextExpand } from './src/main/ets/view/TextExpand'; | AST#export_declaration#Left export { TextExpand } from './src/main/ets/view/TextExpand' ; AST#export_declaration#Right | export { TextExpand } from './src/main/ets/view/TextExpand'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textexpand/Index.ets#L15-L15 | 7513a15fb10f7ae4addb93299821438c1d688043 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Chip.d.ets | arkts | Defines accessibility icon options.
@interface AccessibilityOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 14 | export interface AccessibilityOptions {
/**
* Set accessibility level for accessibility icon.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 14
*/
accessibilityLevel?: string;
/**
* Set accessibility tex... | AST#export_declaration#Left export AST#interface_declaration#Left interface AccessibilityOptions AST#object_type#Left { /**
* Set accessibility level for accessibility icon.
*
* @type { ?string }
* @default "auto"
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @s... | export interface AccessibilityOptions {
accessibilityLevel?: string;
accessibilityText?: ResourceStr;
accessibilityDescription?: ResourceStr;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Chip.d.ets#L315-L349 | 298411d86dcf35102d0f7ca80f239cdb22f15d40 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | TODO 工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export class Helper {
/**
* 检查API版本是否安全
* @param apiVersion API方法支持的最低版本
*/
static isApiSupported(apiVersion: number): boolean {
return deviceInfo.sdkApiVersion >= apiVersion;
}
/**
* 判断字符串是否为空(undefined、null)
* @param str 被检测的字符串
* @returns 是否为空
*/
static isNull(str: string | numb... | AST#export_declaration#Left export AST#class_declaration#Left class Helper AST#class_body#Left { /**
* 检查API版本是否安全
* @param apiVersion API方法支持的最低版本
*/ AST#method_declaration#Left static isApiSupported AST#parameter_list#Left ( AST#parameter#Left apiVersion : AST#type_annotation#Left AST#primary_type#Left numbe... | export class Helper {
static isApiSupported(apiVersion: number): boolean {
return deviceInfo.sdkApiVersion >= apiVersion;
}
static isNull(str: string | number | undefined | null): boolean {
return str === undefined || str === null;
}
static isNotNull(str: string | number | undefined | nul... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L30-L294 | 55c27d9f0e7680337b936975531942a6ddda0d0f | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.