nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FoldableGuilde/entry/src/main/ets/pages/Index.ets | arkts | onPageShow | Monitor the change of folding state to obtain the current width and height of the screen | onPageShow(): void {
try {
// [Start foldDisplayModeChange]
display.on('foldDisplayModeChange', (data: display.FoldDisplayMode) => {
let displayInfo: display.Display = display.getDefaultDisplaySync();
if (data === display.FoldDisplayMode.FOLD_DISPLAY_MODE_FULL) {
console.info('... | AST#method_declaration#Left onPageShow 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#try_statement#Left try AST#block_statement#Left { // [Start foldDisplayMode... | onPageShow(): void {
try {
display.on('foldDisplayModeChange', (data: display.FoldDisplayMode) => {
let displayInfo: display.Display = display.getDefaultDisplaySync();
if (data === display.FoldDisplayMode.FOLD_DISPLAY_MODE_FULL) {
console.info('当前屏幕状态:全屏显示');
console... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/pages/Index.ets#L35-L54 | caa014c0475de954474f66b21e90989c1f58a53f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toStorageSetting | 跳转存储设置页面 | static toStorageSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_STORAGE);
} | AST#method_declaration#Left static toStorageSetting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#typ... | static toStorageSetting(): Promise<void> {
return WantUtil.toSetting(WantUtil.URI_STORAGE);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L171-L173 | 80ce79520917819df78e66c50c182b8634dec9d0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | endCurrentSession | 结束当前会话 | endCurrentSession(): void {
const eventData: AppCloseEventData = {
sessionDuration: Date.now() - this.sessionStartTime
};
this.trackEvent('app_close', eventData);
this.saveUsageData();
} | AST#method_declaration#Left endCurrentSession AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left eventDa... | endCurrentSession(): void {
const eventData: AppCloseEventData = {
sessionDuration: Date.now() - this.sessionStartTime
};
this.trackEvent('app_close', eventData);
this.saveUsageData();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L949-L956 | a460876ba22c53d07136a1437bda33d78d22bd8c | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/web_actions.ets | arkts | Web UI Events
Should be called when a tab receives its title.
@param pk The tab_info_packed. | export function on_title_receive(pk: tab_info_packed) {
// Ask tab to update its info
let tabs = pk.storage.get('bunch_of_tabs') as bunch_of_tabs;
try {
let title = pk.update_title();
let url = pk.update_url();
tabs.update_backward_forward_access();
// sync lists
(pk.storage.get('tab_titles')... | AST#export_declaration#Left export AST#function_declaration#Left function on_title_receive AST#parameter_list#Left ( AST#parameter#Left pk : AST#type_annotation#Left AST#primary_type#Left tab_info_packed AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function on_title_receive(pk: tab_info_packed) {
let tabs = pk.storage.get('bunch_of_tabs') as bunch_of_tabs;
try {
let title = pk.update_title();
let url = pk.update_url();
tabs.update_backward_forward_access();
(pk.storage.get('tab_titles') as string[])[pk.index] = title;
(pk.s... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L71-L108 | 374c6fc3802a1ebd2a9bddbd8045da3641133b6a | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/product/entry/src/main/ets/pages/EntryView.ets | arkts | onBackPress | 侧滑返回拦截功能:用于首页侧滑返回时,需在1秒内侧滑两次才能退出应用 | onBackPress(): boolean {
if (this.sideBarIsShow) {
animateTo({
duration: 300
}, () => {
this.sideBarIsShow = false;
})
return true;
}
// 若子路由还发生了跳转先返回再退出应用
if (this.pageStack.size() > 0) {
DynamicsRouter.popAppRouter();
return true;
}
if (this.... | AST#method_declaration#Left onBackPress 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_ex... | onBackPress(): boolean {
if (this.sideBarIsShow) {
animateTo({
duration: 300
}, () => {
this.sideBarIsShow = false;
})
return true;
}
if (this.pageStack.size() > 0) {
DynamicsRouter.popAppRouter();
return true;
}
if (this.isSecondPressBack) {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/pages/EntryView.ets#L201-L228 | cebb17cc531686ab9169626c268f51dd3d0b8b8b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets | arkts | accountLogin | 帐号登录 | async accountLogin(accountName: string) {
let info: dlpInfo = {
name: "aa",
id: "1234",
event: "Ohos.account.event.LOGIN",
nickname: "nickname",
avatar: "avatar",
};
if (accountName) {
info.name = accountName;
Logger.info(TAG, "info.name:" + accountName);
} else... | AST#method_declaration#Left async accountLogin AST#parameter_list#Left ( AST#parameter#Left accountName : 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_decla... | async accountLogin(accountName: string) {
let info: dlpInfo = {
name: "aa",
id: "1234",
event: "Ohos.account.event.LOGIN",
nickname: "nickname",
avatar: "avatar",
};
if (accountName) {
info.name = accountName;
Logger.info(TAG, "info.name:" + accountName);
} else... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L344-L372 | eaba5828e424254493139d5d73150352e507c571 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CrashUtil.ets | arkts | setRestartWant | 设置下次恢复主动拉起场景下的Ability。该Ability必须为当前包下的UIAbility。
@param want 通过设置Want中"bundleName"和"abilityName"字段来指定恢复重启的Ability。 | static setRestartWant(want: Want) {
appRecovery.setRestartWant(want);
} | AST#method_declaration#Left static setRestartWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#exp... | static setRestartWant(want: Want) {
appRecovery.setRestartWant(want);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L190-L192 | fe12ddaad87fab505fe8e6cc27e3128c4fc4e8ac | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Custom transition scale. | export const CUSTOM_TRANSITION_SCALE: CustomTransition = { x: 0, y: 0 }; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CUSTOM_TRANSITION_SCALE : AST#type_annotation#Left AST#primary_type#Left CustomTransition AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#... | export const CUSTOM_TRANSITION_SCALE: CustomTransition = { x: 0, y: 0 }; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L80-L80 | 494b50ef45c343bec821f48f965b1c0b1d8ff6b7 | gitee | |
wenfujing/honms-super-market.git | 0858abecd8be5db7b8dcf88dcd77b7c66d37517a | common/src/main/ets/utils/LocalDataManager.ets | arkts | queryCommodityList | Query commodity list.
@returns Commodity[] | queryCommodityList() {
return commodityData;
} | AST#method_declaration#Left queryCommodityList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left commodityData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#metho... | queryCommodityList() {
return commodityData;
} | https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L33-L35 | cb02eae3d280c593cffc2e8a8a110376ca497b37 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/InteractAwardBuilder.ets | arkts | @description ai 精彩回放信息 | export class VHAwardModel {
image_url: string = '';
title: string = '';
sub_title: string = '';
} | AST#export_declaration#Left export AST#class_declaration#Left class VHAwardModel AST#class_body#Left { AST#property_declaration#Left image_url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration... | export class VHAwardModel {
image_url: string = '';
title: string = '';
sub_title: string = '';
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/InteractAwardBuilder.ets#L151-L157 | 95d83a30f66438997c97088f87c6aab3d5173f7b | gitee | |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets | arkts | unSubscribeCollectEvent | 取消订阅收藏event | unSubscribeCollectEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_COLLECT, key)
} | AST#method_declaration#Left unSubscribeCollectEvent 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#builder_function_body#Left { AST#expression_statement#Left AST#... | unSubscribeCollectEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_COLLECT, key)
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets#L177-L179 | 6664fbadbd4c7d4f6cb5e4d0631cce20e08b6540 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/BundleManagerDocsSample/HarSample/library/src/main/ets/components/mainpage/MainPage.ets | arkts | MainPage | 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... | @Component
export struct MainPage {
@State message: string = 'HAR MainPage';
build() {
Column() {
Row() {
Text(this.message)
.fontSize(32)
.fontWeight(FontWeight.Bold)
}
.margin({ top: '32px' })
.width('624px')
Flex({ justifyContent: FlexAlign.Center, ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio... | @Component
export struct MainPage {
@State message: string = 'HAR MainPage';
build() {
Column() {
Row() {
Text(this.message)
.fontSize(32)
.fontWeight(FontWeight.Bold)
}
.margin({ top: '32px' })
.width('624px')
Flex({ justifyContent: FlexAlign.Center, ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/BundleManagerDocsSample/HarSample/library/src/main/ets/components/mainpage/MainPage.ets#L16-L44 | e21fd96466d8de38252ab4b5fdc367915e6eb5b7 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/RabinKarp.ets | arkts | findAll | 查找所有匹配位置
@param text 要搜索的文本
@param pattern 要查找的模式串
@returns 所有匹配位置的数组 | public static findAll(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length > text.length) {
return [];
}
const positions: number[] = [];
const patternHash = RabinKarp.hash(pattern);
const patternLength = pattern.length;
const textLength = text.length;
le... | AST#method_declaration#Left public static findAll AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | public static findAll(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length > text.length) {
return [];
}
const positions: number[] = [];
const patternHash = RabinKarp.hash(pattern);
const patternLength = pattern.length;
const textLength = text.length;
le... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L102-L131 | 0dee4c01609584e35864c9da09aed74a0a07f29f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | updateReminderSettings | 更新提醒设置
@param reminderSettings 提醒设置
@returns 更新后的提醒设置 | async updateReminderSettings(reminderSettings: Partial<ReminderSettings>): Promise<ReminderSettings> {
const updatedSettings = await this.updateSettings({ reminder: reminderSettings });
return updatedSettings.reminder;
} | AST#method_declaration#Left async updateReminderSettings AST#parameter_list#Left ( AST#parameter#Left reminderSettings : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ReminderSettings AST#primary_type#Right AST#type_... | async updateReminderSettings(reminderSettings: Partial<ReminderSettings>): Promise<ReminderSettings> {
const updatedSettings = await this.updateSettings({ reminder: reminderSettings });
return updatedSettings.reminder;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L220-L223 | 061d00a13e07a0a2e64605a1e8a0df61a4959ca3 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/model/VideoControll.ets | arkts | Get video string of current time.
@param the number of current time
@return the string of current time | export function changeSliderTime(value: number): string {
let second: number = value % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((value / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : sec... | AST#export_declaration#Left export AST#function_declaration#Left function changeSliderTime AST#parameter_list#Left ( AST#parameter#Left value : 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... | export function changeSliderTime(value: number): string {
let second: number = value % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((value / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_STR}${second}` : sec... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/model/VideoControll.ets#L23-L30 | 58dae248c5ce1da2385c30e33ac1b2c0d78a3449 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/MD5.ets | arkts | hmacSync | 消息认证码计算,同步
@param data 传入的消息
@param symKey 共享对称密钥。
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 | static hmacSync(data: string, symKey: cryptoFramework.SymKey = MD5.symKey,
resultCoding: crypto.BhCoding = 'hex'): string {
return CryptoUtil.hmacSync(data, 'MD5', symKey, resultCoding);
} | AST#method_declaration#Left static hmacSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ... | static hmacSync(data: string, symKey: cryptoFramework.SymKey = MD5.symKey,
resultCoding: crypto.BhCoding = 'hex'): string {
return CryptoUtil.hmacSync(data, 'MD5', symKey, resultCoding);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/MD5.ets#L92-L95 | 56576a88c2982ea14ae1f8f54cea2b59b37c4bce | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | AI祝福语生成配置接口 | export interface AIGreetingConfig {
enabled: boolean;
apiProvider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
customPrompt?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AIGreetingConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left apiProvider : AST#type_a... | export interface AIGreetingConfig {
enabled: boolean;
apiProvider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
customPrompt?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L125-L134 | 6c890179ab93f2cb0e3789bbf0c0db84b6d65a73 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildStyleSelector | 构建样式选择器 | @Builder
buildStyleSelector() {
Column() {
// 背景遮罩
Row()
.width('100%')
.layoutWeight(1)
.backgroundColor('rgba(0,0,0,0.3)')
.onClick(() => {
this.showStyleSelector = false;
})
// 选择器内容
Column({ space: 16 }) {
Text('选择祝福语风格')... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStyleSelector AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 背景遮罩 AS... | @Builder
buildStyleSelector() {
Column() {
Row()
.width('100%')
.layoutWeight(1)
.backgroundColor('rgba(0,0,0,0.3)')
.onClick(() => {
this.showStyleSelector = false;
})
Column({ space: 16 }) {
Text('选择祝福语风格')
.fon... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L605-L651 | 269aad67dc525cf53ec83164cbbbb682438bf0c2 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/SpeechRecognizerHelper.ets | arkts | cancel | 取消识别。为了确保事件回调,请优先调用setListener。
@param sessionId 会话ID。 | static cancel(sessionId: string): void {
SpeechRecognizerHelper.recognitionEngine?.cancel(sessionId);
} | AST#method_declaration#Left static cancel AST#parameter_list#Left ( AST#parameter#Left sessionId : 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 void AST#primary_type#... | static cancel(sessionId: string): void {
SpeechRecognizerHelper.recognitionEngine?.cancel(sessionId);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/SpeechRecognizerHelper.ets#L104-L106 | c57682989af3c8e5b04fdebb62c95516ba464e3b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getNoonContent | Get noon content in MainViewModel.
@param hour number
@return content string | public getNoonContent(hour: number): string{
return (hour < CommonConstants.DEFAULT_TOTAL_HOUR
? MainConstant.DEFAULT_STRING_MORNING
: MainConstant.DEFAULT_STRING_AFTERNOON);
} | AST#method_declaration#Left public getNoonContent 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | public getNoonContent(hour: number): string{
return (hour < CommonConstants.DEFAULT_TOTAL_HOUR
? MainConstant.DEFAULT_STRING_MORNING
: MainConstant.DEFAULT_STRING_AFTERNOON);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets#L98-L102 | c16a086fe5763878b788ab55529f91a141e4ce2d | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/auth/AuthUtil.ets | arkts | reqPermissions | 发起授权 以Promise方式返回
@param permissions 需要授权的权限
@returns 1表示授权成功继续业务操作,-1表示用户拒绝授权 | static async reqPermissions(permissions: Permissions): Promise<number> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
let request = await atManager.requestPermissionsFromUser(getContext() as common.UIAbilityContext, [permi... | AST#method_declaration#Left static async reqPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left A... | static async reqPermissions(permissions: Permissions): Promise<number> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let request = await atManager.requestPermissionsFromUser(getContext() as common.UIAbilityContext, [permissions]);
let grantStatus: Array<number> = r... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/auth/AuthUtil.ets#L106-L122 | cfbab5b30e7cf80e3b5f0243596973b1dface692 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/FileUtils.ets | arkts | getCacheDirPath | 获取缓存目录下的文件夹路径或文件路径。
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns | static getCacheDirPath(dirPath: string | undefined = undefined, fileName: string | undefined = undefined,
blHap: boolean = true, area: contextConstant.AreaMode = contextConstant.AreaMode.EL2): string {
let context = blHap ? ArkWebHelper.getContext() : ArkWebHelper.getContext().getApplicationContext();
conte... | AST#method_declaration#Left static getCacheDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#express... | static getCacheDirPath(dirPath: string | undefined = undefined, fileName: string | undefined = undefined,
blHap: boolean = true, area: contextConstant.AreaMode = contextConstant.AreaMode.EL2): string {
let context = blHap ? ArkWebHelper.getContext() : ArkWebHelper.getContext().getApplicationContext();
conte... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L67-L86 | 8b288f20d36f1b397cf31b605c07576c9d35e630 | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/AppState.ets | arkts | clearUserData | 清除用户数据 | public async clearUserData() {
this._userInfo = null;
this._token = null;
this._isLoggedIn = false;
// 关键修复:清除AppStorage中的用户状态
AppStorage.setOrCreate('currentUserId', '');
AppStorage.setOrCreate('isLoggedIn', false);
try {
if (this.storage) {
await this.storage.delete('userDa... | AST#method_declaration#Left public async clearUserData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _userInfo ... | public async clearUserData() {
this._userInfo = null;
this._token = null;
this._isLoggedIn = false;
AppStorage.setOrCreate('currentUserId', '');
AppStorage.setOrCreate('isLoggedIn', false);
try {
if (this.storage) {
await this.storage.delete('userData');
await this.s... | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/AppState.ets#L140-L160 | 696525c30542e9552a712f48bf1031e084b035f6 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/diggingholescreen/src/main/ets/components/mainpage/DiggingHoleScreen.ets | arkts | aboutToAppear | 获取UIAbilityContext | aboutToAppear(): void {
// 获取窗口实例
window.getLastWindow(this.context, (err, data) => {
if (err.code !== 0) {
logger.error('DiggingHoleScreen', 'getLastWindow failed. error is:' + JSON.stringify(err));
return;
}
// 设置窗口为全屏显示状态
data.setWindowLayoutFullScreen(true);
// ... | 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#... | aboutToAppear(): void {
window.getLastWindow(this.context, (err, data) => {
if (err.code !== 0) {
logger.error('DiggingHoleScreen', 'getLastWindow failed. error is:' + JSON.stringify(err));
return;
}
data.setWindowLayoutFullScreen(true);
data.setWindowSyste... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/diggingholescreen/src/main/ets/components/mainpage/DiggingHoleScreen.ets#L54-L101 | b0359bf88e606f54caa38ccb5583a561ac807eb5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/SecondFloor.ets | arkts | SecondFloor | 回弹固定高度动效时间 | @Component
export struct SecondFloor {
@Provide startPackUpFloor: boolean = false; // 监听当处于二楼状态点击标题时的状态
@StorageLink("statusHeight") topRectHeight: number | undefined = AppStorage.get('statusHeight'); // 顶部系统导航栏高度
@StorageLink("bottomHeight") bottomRectHeight: number | undefined = AppStorage.get('bottomHeight'); ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SecondFloor AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Provide AST#decorator#Right startPackUpFloor : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST... | @Component
export struct SecondFloor {
@Provide startPackUpFloor: boolean = false;
@StorageLink("statusHeight") topRectHeight: number | undefined = AppStorage.get('statusHeight');
@StorageLink("bottomHeight") bottomRectHeight: number | undefined = AppStorage.get('bottomHeight');
@State floorHeight: number = ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/SecondFloor.ets#L35-L139 | 9e5d629ac92113e6d6db0904a3a1ec427fbce40c | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/RadarDataSet.ets | arkts | getHighlightCircleStrokeColor | / Returns the stroke color for highlight circle. / If Utils.COLOR_NONE, the color of the dataset is taken. | public getHighlightCircleStrokeColor(): number {
return this.mHighlightCircleStrokeColor;
} | AST#method_declaration#Left public getHighlightCircleStrokeColor 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#Lef... | public getHighlightCircleStrokeColor(): number {
return this.mHighlightCircleStrokeColor;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/RadarDataSet.ets#L55-L57 | d8af9491026300604b28c0964ffb0a6f5d5b6879 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/datatype/collections/list_001_T.ets | arkts | Introduction 集合-列表类型 | export function list_001_T(taint_src : List<string>) {
taint.Sink(taint_src);
} | AST#export_declaration#Left export AST#function_declaration#Left function list_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left List AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right A... | export function list_001_T(taint_src : List<string>) {
taint.Sink(taint_src);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/collections/list_001_T.ets#L6-L8 | 4dc8686dec06a3f0e7c8a4f220c77f3ca068ffbe | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/ContactTypes.ets | arkts | 联系人更新参数接口 | export interface UpdateContactParams {
name?: string;
phone?: string;
email?: string;
birthday?: BirthdayInfo;
relation?: RelationType;
gender?: Gender;
avatar?: string;
tags?: string[];
notes?: string;
isFavorite?: boolean;
intimacyLevel?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UpdateContactParams 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 phone ? : AST#type_anno... | export interface UpdateContactParams {
name?: string;
phone?: string;
email?: string;
birthday?: BirthdayInfo;
relation?: RelationType;
gender?: Gender;
avatar?: string;
tags?: string[];
notes?: string;
isFavorite?: boolean;
intimacyLevel?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L177-L189 | be9540b57e8f725ee7487eeb6780d9c413a20fe2 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets | arkts | totalCount | 获取数据总数
@returns | public totalCount(): number {
return this.originDataArray.length;
} | AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | public totalCount(): number {
return this.originDataArray.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/DataSource.ets#L53-L55 | de78d51b07bb414d2feb5106ae89b08ce46172ad | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | fileprivate var _book: Book? //缓存用 | constructor(
planId : number | null = null,
planName : string | null,
startDate : Date | null = new Date(),
distances : DistanceFromBase[],
process : number = 0,
bookId : number | null = null,
countPerDay : number,
pieces : Piece[],
boxes : Bo... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left planId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST... | constructor(
planId : number | null = null,
planName : string | null,
startDate : Date | null = new Date(),
distances : DistanceFromBase[],
process : number = 0,
bookId : number | null = null,
countPerDay : number,
pieces : Piece[],
boxes : Bo... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L43-L65 | 298dd93ad6a2cc63b5f25e932b2b173cc764f8b5 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ImageUtil.ets | arkts | packing | packing压缩
@param sourcePixelMap:原始待压缩图片的PixelMap
@param imageQuality:图片质量参数
@param imageFormat:当前只支持"image/jpeg"、"image/webp"、"image/png"和"image/heif"12+(不同硬件设备支持情况不同)。
@returns data:返回压缩后的图片数据 | static async packing(sourcePixelMap: image.PixelMap, imageQuality: number, imageFormat: string = "image/jpeg"): Promise<ArrayBuffer> {
const imagePackerApi = image.createImagePacker();
const packOpts: image.PackingOption = { format: imageFormat, quality: imageQuality };
const data: ArrayBuffer = await image... | AST#method_declaration#Left static async packing AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageQ... | static async packing(sourcePixelMap: image.PixelMap, imageQuality: number, imageFormat: string = "image/jpeg"): Promise<ArrayBuffer> {
const imagePackerApi = image.createImagePacker();
const packOpts: image.PackingOption = { format: imageFormat, quality: imageQuality };
const data: ArrayBuffer = await image... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L302-L308 | 7aaea111255f7f4cc02af1451be911cb77e8f79a | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets | arkts | buildQuickModes | 构建快速模式选择 | @Builder
buildQuickModes() {
Column({ space: 12 }) {
Text('快速设置')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
.fontWeight(FontWeight.Medium)
.width('100%')
Text('选择预设模式以快速配置无障碍功能')
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildQuickModes AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_par... | @Builder
buildQuickModes() {
Column({ space: 12 }) {
Text('快速设置')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
.fontWeight(FontWeight.Medium)
.width('100%')
Text('选择预设模式以快速配置无障碍功能')
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets#L219-L248 | fa467189c1e1126ce9fc1403e755d22dd41113c9 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets | arkts | delete | 删除表格中的数据 | delete(rdbPredicates: dataRdb.RdbPredicates): Promise<number> {
return this.rdbStore.delete(rdbPredicates);
} | AST#method_declaration#Left delete AST#parameter_list#Left ( AST#parameter#Left rdbPredicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataRdb . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty... | delete(rdbPredicates: dataRdb.RdbPredicates): Promise<number> {
return this.rdbStore.delete(rdbPredicates);
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets#L171-L173 | 65bb873236d8ef9b58ccc8b97f1ba1b641ed77a3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/model/MenuOptions.ets | arkts | 自定义底部弹框 | export interface MenuOptions extends BaseDialogOptions {
backgroundColor?: ResourceColor; //弹窗背板颜色。默认值:Color.Transparent
backgroundBlurStyle?: BlurStyle; //弹窗背板模糊材质。默认值:BlurStyle.COMPONENT_ULTRA_THICK
title: string;
menus: Array<MenuBean>;
onItemClick: Callback<MenuBean>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MenuOptions AST#extends_clause#Left extends BaseDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left backgroundColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_... | export interface MenuOptions extends BaseDialogOptions {
backgroundColor?: ResourceColor;
backgroundBlurStyle?: BlurStyle;
title: string;
menus: Array<MenuBean>;
onItemClick: Callback<MenuBean>;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/model/MenuOptions.ets#L5-L12 | 344ea83f1fb1dbc5b2f08a3b486c2964fc6c3f96 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppDataSecurity/entry/src/main/ets/pages/Index.ets | arkts | writeFile | [Start write_file] | function writeFile(filePath: string, data: string): void {
try {
let file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
let writeLen = fileIo.writeSync(file.fd, data);
hilog.info(0x0000, 'AppDataSecurity', 'The length of str is: ' + writeLen);
fileIo.closeSync(file)... | AST#function_declaration#Left function writeFile 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#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | function writeFile(filePath: string, data: string): void {
try {
let file = fileIo.openSync(filePath, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
let writeLen = fileIo.writeSync(file.fd, data);
hilog.info(0x0000, 'AppDataSecurity', 'The length of str is: ' + writeLen);
fileIo.closeSync(file)... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppDataSecurity/entry/src/main/ets/pages/Index.ets#L93-L102 | 2af19f5c503fbf2023552b61f6ca2eb89f4d131e | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | getLineColor | Returns the color that is used for this LimitLine
@return | public getLineColor(): number | string {
return this.mLineColor;
} | AST#method_declaration#Left public getLineColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement... | public getLineColor(): number | string {
return this.mLineColor;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L103-L105 | bb2a221eee6a4fb987515c568cf4fe82bb416336 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | setHighlightCircleStrokeColor | Sets the stroke color for highlight circle. Set to Utils.COLOR_NONE in order to use the color of the dataset; | public setHighlightCircleStrokeColor(color): void {
this.mHighlightCircleStrokeColor = color;
} | AST#method_declaration#Left public setHighlightCircleStrokeColor AST#parameter_list#Left ( AST#parameter#Left color AST#parameter#Right ) 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_statem... | public setHighlightCircleStrokeColor(color): void {
this.mHighlightCircleStrokeColor = color;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets#L72-L74 | dd7d99f2772adbb190108c711fe98c0e6b693761 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/InteractiveGameService.ets | arkts | getMemoryCards | 获取记忆匹配卡片 | getMemoryCards(contacts: Contact[], pairs: number = 8): MemoryCard[] {
const cards: MemoryCard[] = [];
const selectedContacts = contacts.slice(0, pairs);
selectedContacts.forEach((contact, index) => {
// 创建一对卡片
cards.push({
id: `card_${index}_1`,
content: contact.name,
i... | AST#method_declaration#Left getMemoryCards AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pairs : AST#type_annotation#Lef... | getMemoryCards(contacts: Contact[], pairs: number = 8): MemoryCard[] {
const cards: MemoryCard[] = [];
const selectedContacts = contacts.slice(0, pairs);
selectedContacts.forEach((contact, index) => {
cards.push({
id: `card_${index}_1`,
content: contact.name,
isFlipped:... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L392-L420 | eba96362d1b678a7164da636ae4e7a21f3f597aa | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/sync/EncryptionService.ets | arkts | decrypt | 解密数据 | async decrypt(encryptedData: EncryptedData, password?: string): Promise<string> {
try {
const decPassword = password || await this.getDefaultPassword();
hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Decrypting data with algorithm: ${encryptedData.algorithm}`);
// 验证校验和
... | AST#method_declaration#Left async decrypt AST#parameter_list#Left ( AST#parameter#Left encryptedData : AST#type_annotation#Left AST#primary_type#Left EncryptedData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password ? : AST#type_annotation#Left AST#primary_type#Left string... | async decrypt(encryptedData: EncryptedData, password?: string): Promise<string> {
try {
const decPassword = password || await this.getDefaultPassword();
hilog.debug(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Decrypting data with algorithm: ${encryptedData.algorithm}`);
const... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/sync/EncryptionService.ets#L74-L109 | 8f69afa30a1e92db6cb20434d95bebac5be3bf00 | github |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/configure/sqlite.ets | arkts | closeAllDatabases | 关闭/删除/清理 所有 Database | static async closeAllDatabases(): Promise<void> {
await Sqliter.closeUserDatabase()
await Sqliter.closeAppDatabase()
} | AST#method_declaration#Left static async closeAllDatabases 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 > ... | static async closeAllDatabases(): Promise<void> {
await Sqliter.closeUserDatabase()
await Sqliter.closeAppDatabase()
} | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/configure/sqlite.ets#L89-L92 | 5be4fa21c6cffeef15ae1155c434dcb3406bcffe | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 创建祝福语参数接口 | export interface CreateGreetingParams {
content: string;
style: GreetingStyle;
occasion: GreetingOccasion;
language?: GreetingLanguage;
tags?: string[];
isCustom?: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface CreateGreetingParams AST#object_type#Left { AST#type_member#Left content : 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 style : AST#type_anno... | export interface CreateGreetingParams {
content: string;
style: GreetingStyle;
occasion: GreetingOccasion;
language?: GreetingLanguage;
tags?: string[];
isCustom?: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L205-L212 | 429b7f28f67786bb3e1b5a77436e9717447e1332 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarChartModel.ets | arkts | getBarBoundsByEntry | Returns the bounding box of the specified Entry in the specified DataSet. Returns null if the Entry could not be
found in the charts data. Performance-intensive code should use void getBarBounds(BarEntry, RectF) instead.
@param e
@return | public getBarBoundsByEntry(e: BarEntry): MyRect {
let bounds: MyRect = new MyRect();
this.getBarBounds(e, bounds);
return bounds;
} | AST#method_declaration#Left public getBarBoundsByEntry AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left BarEntry AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MyRect AST#prim... | public getBarBoundsByEntry(e: BarEntry): MyRect {
let bounds: MyRect = new MyRect();
this.getBarBounds(e, bounds);
return bounds;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L152-L158 | c397b141cab862a829f98934872cb5c3f93484c6 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets | arkts | deleteFile | 删除指定音频
@param fileAsset 音频资源
@returns void | async deleteFile(fileAsset: userFileManager.FileAsset): Promise<void> {
Logger.info(TAG, `mst deleteFile,title = ${fileAsset.displayName},uri = ${fileAsset.uri}`);
try {
await this.mediaTest!.delete(fileAsset.uri);
Logger.info(TAG, `trash successfully`);
} catch (error) {
Logger.error(TAG,... | AST#method_declaration#Left async deleteFile AST#parameter_list#Left ( AST#parameter#Left fileAsset : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userFileManager . FileAsset AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Righ... | async deleteFile(fileAsset: userFileManager.FileAsset): Promise<void> {
Logger.info(TAG, `mst deleteFile,title = ${fileAsset.displayName},uri = ${fileAsset.uri}`);
try {
await this.mediaTest!.delete(fileAsset.uri);
Logger.info(TAG, `trash successfully`);
} catch (error) {
Logger.error(TAG,... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Recorder/entry/src/main/ets/model/MediaManager.ets#L119-L127 | c4e20865320417ab4abc77cb363cf36e432554ea | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FileUploadAndDownloadSlow/entry/src/main/ets/pages/ZipUploadPage.ets | arkts | zipUploadFiles | [Start zip_upload_page] Data compression processing | async zipUploadFiles(fileUris: Array<string>): Promise<void> {
try {
this.context = this.getUIContext().getHostContext() as common.UIAbilityContext;
let cacheDir = this.context.cacheDir;
let tempDir = fileIo.mkdtempSync(`${cacheDir}/XXXXXX`);
// Put the uri obtained from the library picture ... | AST#method_declaration#Left async zipUploadFiles AST#parameter_list#Left ( AST#parameter#Left fileUris : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_... | async zipUploadFiles(fileUris: Array<string>): Promise<void> {
try {
this.context = this.getUIContext().getHostContext() as common.UIAbilityContext;
let cacheDir = this.context.cacheDir;
let tempDir = fileIo.mkdtempSync(`${cacheDir}/XXXXXX`);
for (let i = 0; i < fileUris.length; i++) ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FileUploadAndDownloadSlow/entry/src/main/ets/pages/ZipUploadPage.ets#L43-L70 | 97099da8e969fac9558a37dfd7cde90987a192c0 | gitee |
liudi25385/mybit.git | 865f64ff6b2e10f5b79100064dff05e67607a5bc | entry/src/main/ets/net/CustomNetPlugin.ets | arkts | prepareRequest | 请求之前拦截请求 可以做很多操作,比如添加头参,加密等等,如果需要,可重写方法,否则不用,可删除此方法 | prepareRequest(request: NetRequest): Promise<NetRequest> {
return new Promise((resolve: Function) => {
resolve(request)
});
} | AST#method_declaration#Left prepareRequest AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left NetRequest 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#Le... | prepareRequest(request: NetRequest): Promise<NetRequest> {
return new Promise((resolve: Function) => {
resolve(request)
});
} | https://github.com/liudi25385/mybit.git/blob/865f64ff6b2e10f5b79100064dff05e67607a5bc/entry/src/main/ets/net/CustomNetPlugin.ets#L15-L19 | 5c74df4451edd69d110e31f270b0862a6746479b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets | arkts | setImmersive | 当前主窗口是否开启沉浸模式
@returns {void} | setImmersive(popPage?: () => void) {
if (this.windowStage === undefined) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to obtain the main window. Code:${err.code}, me... | 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) {
logger.error('windowStage is undefined.');
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
logger.error(`Failed to obtain the main window. Code:${err.code}, me... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/WindowModel.ets#L113-L134 | d0349c09e82b9fbceaa92a2d3fc5c357f2cb2f98 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/CategoryTree.ets | arkts | fromCategory | 从 Category 转换为 CategoryTree | static fromCategory(category: Category): CategoryTree {
return new CategoryTree({
id: category.id,
name: category.name,
parentId: category.parentId ?? null,
sortNum: category.sortNum,
pic: category.pic ?? null,
status: category.status,
createTime: category.createTime ?? nul... | AST#method_declaration#Left static fromCategory AST#parameter_list#Left ( AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left Category AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CategoryTree AS... | static fromCategory(category: Category): CategoryTree {
return new CategoryTree({
id: category.id,
name: category.name,
parentId: category.parentId ?? null,
sortNum: category.sortNum,
pic: category.pic ?? null,
status: category.status,
createTime: category.createTime ?? nul... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/CategoryTree.ets#L60-L72 | 3c490267d12681d28bf977789387c95a986cbf7f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/DatabaseService.ets | arkts | createTables | 创建数据表 | private async createTables(): Promise<void> {
try {
// 创建联系人表
const createContactsTableSql = `
CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_CONTACTS} (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
avatar TEXT,
phone TEXT,
email TEXT,
... | AST#method_declaration#Left private async createTables AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#... | private async createTables(): Promise<void> {
try {
const createContactsTableSql = `
CREATE TABLE IF NOT EXISTS ${StorageConstants.TABLE_CONTACTS} (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
avatar TEXT,
phone TEXT,
email TEXT,
relation... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/DatabaseService.ets#L60-L152 | 1a10c7bd6eaaae451c7dba9569de0ec0987a89ec | github |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/Immersive.ets | arkts | 恢复默认导航栏 | export function resetNavBar(ctx: common.Context | undefined) {
// 1. 获取当前窗口
window.getLastWindow(ctx, (err: BusinessError, win: window.Window) => {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
// 2. 设置导航区域隐藏
win.setSpecificSystemBarEnabled('navigationIndicator', true... | AST#export_declaration#Left export AST#function_declaration#Left function resetNavBar AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left und... | export function resetNavBar(ctx: common.Context | undefined) {
window.getLastWindow(ctx, (err: BusinessError, win: window.Window) => {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
win.setSpecificSystemBarEnabled('navigationIndicator', true).then(() => {
conso... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/Immersive.ets#L23-L37 | f0658b9c9f7e182b91536ca7b069c144b9abcf87 | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/VigenereCipher.ets | arkts | 维吉尼亚密码实现
维吉尼亚密码是一种多表替换密码,使用一个关键词作为密钥 | export class VigenereCipher {
/**
* 加密文本
* @param text 要加密的文本
* @param key 密钥
* @returns 加密后的文本
*/
static encrypt(text: string, key: string): string {
if (!text || !key) {
return '';
}
const normalizedKey = key.toUpperCase();
let result = '';
let keyIndex = 0;
for (let... | AST#export_declaration#Left export AST#class_declaration#Left class VigenereCipher AST#class_body#Left { /**
* 加密文本
* @param text 要加密的文本
* @param key 密钥
* @returns 加密后的文本
*/ AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary... | export class VigenereCipher {
static encrypt(text: string, key: string): string {
if (!text || !key) {
return '';
}
const normalizedKey = key.toUpperCase();
let result = '';
let keyIndex = 0;
for (let i = 0; i < text.length; i++) {
const char = text[i];
if (char >= 'A' &... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/VigenereCipher.ets#L5-L77 | 4976adbcd23ecb0420d8759ab03a71cc932d851e | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 祝福语风格枚举 | export enum GreetingStyle {
WARM = 'warm', // 温馨
FORMAL = 'formal', // 正式
HUMOROUS = 'humorous', // 幽默
POETIC = 'poetic', // 诗意
SIMPLE = 'simple' // 简洁
} | AST#export_declaration#Left export AST#enum_declaration#Left enum GreetingStyle AST#enum_body#Left { AST#enum_member#Left WARM = AST#expression#Left 'warm' AST#expression#Right AST#enum_member#Right , // 温馨 AST#enum_member#Left FORMAL = AST#expression#Left 'formal' AST#expression#Right AST#enum_member#Right , // 正式 AST... | export enum GreetingStyle {
WARM = 'warm',
FORMAL = 'formal',
HUMOROUS = 'humorous',
POETIC = 'poetic',
SIMPLE = 'simple'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L66-L72 | 17cc2dcfb41e9aa361cc143e5d1967f953bab6e4 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/user/UserNavigator.ets | arkts | toAddressList | 跳转到收货地址列表
@param {boolean} isSelectMode - 是否为选择模式(默认 false)
@returns {Promise<UserSelectAddressResult | undefined>} 返回选中的地址结果 Promise | static toAddressList(isSelectMode: boolean = false): Promise<UserSelectAddressResult | undefined> {
const params: UserAddressListParam = { isSelectMode };
return navigateToForResult<UserSelectAddressResult>(UserRoutes.AddressList, params);
} | AST#method_declaration#Left static toAddressList AST#parameter_list#Left ( AST#parameter#Left isSelectMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#par... | static toAddressList(isSelectMode: boolean = false): Promise<UserSelectAddressResult | undefined> {
const params: UserAddressListParam = { isSelectMode };
return navigateToForResult<UserSelectAddressResult>(UserRoutes.AddressList, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/user/UserNavigator.ets#L25-L28 | 1af877a94d40a16c114e11d3bdfdd33c3666af62 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/SavePhotoUtils.ets | arkts | SavePhotoUtils
HarmonyOS 5.0 工具类:用于保存图片至系统相册
支持 PixelMap、路径、屏幕截图、多张图片 | export class SavePhotoUtils {
/**
* 将 PixelMap 保存到系统相册
* @param context 上下文对象
* @param pixel PixelMap 对象
* @param format 保存格式 (默认 'jpeg')
*/
static async savePixelMapToAlbum(pixel: image.PixelMap | null | undefined, format: 'jpeg' | 'png' = 'png') {
if (!pixel) return console.error('❌ pixelMap 为... | AST#export_declaration#Left export AST#class_declaration#Left class SavePhotoUtils AST#class_body#Left { /**
* 将 PixelMap 保存到系统相册
* @param context 上下文对象
* @param pixel PixelMap 对象
* @param format 保存格式 (默认 'jpeg')
*/ AST#method_declaration#Left static async savePixelMapToAlbum AST#parameter_list#Left ( AS... | export class SavePhotoUtils {
static async savePixelMapToAlbum(pixel: image.PixelMap | null | undefined, format: 'jpeg' | 'png' = 'png') {
if (!pixel) return console.error('❌ pixelMap 为空');
try {
const context = getAppContext()
const helper = photoAccessHelper.getPhotoAccessHelper(context);
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/SavePhotoUtils.ets#L14-L78 | 2766e03b233a29d60e91a6bfdcc6c514464335c2 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets | arkts | @memo | export function hookTextTimerContentModifier(
receiver: ArkTextTimerComponent, value?: ContentModifier<TextTimerConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const textTimerBuilder = (parentNode: KPointer, config: TextTimerConfiguration): KPoi... | AST#export_declaration#Left export AST#function_declaration#Left function hookTextTimerContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkTextTimerComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left va... | export function hookTextTimerContentModifier(
receiver: ArkTextTimerComponent, value?: ContentModifier<TextTimerConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const textTimerBuilder = (parentNode: KPointer, config: TextTimerConfiguration): KPoi... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L242-L255 | f46bec89415aa581a1ae7339cc47a75e791b0ad5 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WaterFlowSample/entry/src/main/ets/pages/FlowItemRemoveAnimationPage.ets | arkts | [EndExclude quick_start] | build() {
Column({ space: 0 }) {
Refresh({ refreshing: $$this.isRefreshing, builder: this.headerRefresh() }) {
WaterFlow({ scroller: this.scroller, sections: this.sections }) {
LazyForEach(this.dataSource, (item: number) => {
FlowItem() {
Stack() {
R... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right... | build() {
Column({ space: 0 }) {
Refresh({ refreshing: $$this.isRefreshing, builder: this.headerRefresh() }) {
WaterFlow({ scroller: this.scroller, sections: this.sections }) {
LazyForEach(this.dataSource, (item: number) => {
FlowItem() {
Stack() {
R... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/FlowItemRemoveAnimationPage.ets#L225-L306 | 35286064de0ff60b7e51f21fc99bbc31d20d8ef5 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setDrawAxisLine | Set this to true if the line alongside the axis should be drawn or not.
@param enabled | public setDrawAxisLine(enabled: boolean): void {
this.mDrawAxisLine = enabled;
} | AST#method_declaration#Left public setDrawAxisLine AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima... | public setDrawAxisLine(enabled: boolean): void {
this.mDrawAxisLine = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L212-L214 | e486cc370c7dd8021ce089b6ae6f2e26ba87b2aa | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets | arkts | stopRecord | 停止录音 | async stopRecord(): Promise<void> {
await this.stopRecording();
} | AST#method_declaration#Left async stopRecord 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 stopRecord(): Promise<void> {
await this.stopRecording();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets#L67-L69 | ff5c034f2ca42cbda6160f5179cd9dfbf02611ab | github |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/transform/SwirlTransformation.ets | arkts | SwirlTransformation | 图片变换:扭曲效果 | @Sendable
export class SwirlTransformation extends PixelMapTransformation {
// degree:值越大范围越大
private mDegree: number = 0;
// 取值范围 0.0 ~ 1.0
private mAngle: number = 0.9;
// 在图中的位置 取值范围 0.0 ~ 1.0
private mXCenter: number = 0.5;
// 在图中的位置 取值范围 0.0 ~ 1.0
private mYCenter: number = 0.5;
constructor(degr... | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class SwirlTransformation extends AST#type_annotation#Left AST#primary_type#Left PixelMapTransformation AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // degree:值越大范围越大 AST#property_declaration#Left pr... | @Sendable
export class SwirlTransformation extends PixelMapTransformation {
private mDegree: number = 0;
private mAngle: number = 0.9;
private mXCenter: number = 0.5;
private mYCenter: number = 0.5;
constructor(degree: number, angle?: number, centerPoint?: Array<number>) {
super();
this.m... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/transform/SwirlTransformation.ets#L22-L71 | d0d7a690d6e5f0deb40027c5404a3a86acb878fe | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.multimedia.avVolumePanel.d.ets | arkts | AVVolumePanel | A panel to set the system audio output volume.
@syscap SystemCapability.Multimedia.Audio.Volume
@atomicservice
@since 12 | @Component
export declare struct AVVolumePanel {
/**
* Sets the device volume through the volume panel.
* The value should be between mininum and maxinum current device volume, otherwise it will be discarded.
*
* @type { ?number }
* @syscap SystemCapability.Multimedia.Audio.Volume
* @a... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AVVolumePanel AST#component_body#Left { /**
* Sets the device volume through the volume panel.
* The value should be between mininum and maxinum current device volume, ... | @Component
export declare struct AVVolumePanel {
@Prop
volumeLevel?: number;
@Prop
volumeParameter?: AVVolumePanelParameter;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.multimedia.avVolumePanel.d.ets#L43-L66 | 832e722c75aef1a87a04e5cca1f3969dcda44bfb | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | Defines TapGesture.
@extends Gesture
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export declare class TapGesture extends Gesture {
/**
* Set the value.
* TapGestureParameters: The parameters of the tapGesture.
*
* @param { function } factory
* @param { TapGestureParameters } value
* @returns { TapGesture }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @cr... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TapGesture extends AST#type_annotation#Left AST#primary_type#Left Gesture AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* Set the value.
* TapGestureParameters: The parameter... | export declare class TapGesture extends Gesture {
static $_instantiate(factory: () => TapGesture, value?: TapGestureParameters): TapGesture;
onAction(event: Callback<GestureEvent>): TapGesture;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L363-L390 | c23aa97ef52f42aa955a4333b884747d86b44610 | gitee | |
wenqi1/MallHomepage.git | a09765bee60b214f73b875570f8721a004d0bc3b | entry/src/main/ets/model/CommodityModel.ets | arkts | 商品 | export class Commodity {
// 商品id
id: string = '';
// 商品名称
title: string = '';
// 商品推广
promotion?: string = '';
// 商品描述
description?: string = '';
// 商品图片
images: string[] = [];
// 商品详情
detail?: string[] = [];
// 商品价格
price: number = 0;
// 商品规格
specifications?: Specification[] = [];
co... | AST#export_declaration#Left export AST#class_declaration#Left class Commodity AST#class_body#Left { // 商品id AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#R... | export class Commodity {
id: string = '';
title: string = '';
promotion?: string = '';
description?: string = '';
images: string[] = [];
detail?: string[] = [];
price: number = 0;
specifications?: Specification[] = [];
constructor(commodity?: Commodity) {
if (!commodity) {... | https://github.com/wenqi1/MallHomepage.git/blob/a09765bee60b214f73b875570f8721a004d0bc3b/entry/src/main/ets/model/CommodityModel.ets#L16-L47 | 395580165031f05cdcc8fa2f5bfab496216fded3 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/EventControl.ets | arkts | eventIsDisable | 事件是否禁用 | public eventIsDisable(evType: EventType) {
return !this.eventMap.get(evType);
} | AST#method_declaration#Left public eventIsDisable AST#parameter_list#Left ( AST#parameter#Left evType : AST#type_annotation#Left AST#primary_type#Left EventType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statem... | public eventIsDisable(evType: EventType) {
return !this.eventMap.get(evType);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/EventControl.ets#L38-L40 | 3bb55bb17a0c5a39c4785d78f48a6b67b0ec1939 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfSysCodeInterceptor.ets | arkts | @Author csx
@DateTime 2024/8/15 19:07
@TODO RfCryptoInterceptor 内置针对于系统框架级别的请求code拦截器
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_rcp | export class EfSysCodeInterceptor implements rcp.Interceptor {
/**
* 编码监听
*/
private codeEventListener: efRcpConfig.sysCodeEvent;
constructor(codeEventListener: efRcpConfig.sysCodeEvent) {
this.codeEventListener = codeEventListener;
}
/**
* 拦截器
* @param context
* @param next
* @returns... | AST#export_declaration#Left export AST#class_declaration#Left class EfSysCodeInterceptor AST#implements_clause#Left implements AST#implements_clause#Right AST#ERROR#Left AST#qualified_type#Left rcp . Interceptor AST#qualified_type#Right AST#ERROR#Right AST#class_body#Left { /**
* 编码监听
*/ AST#property_declaration#... | export class EfSysCodeInterceptor implements rcp.Interceptor {
private codeEventListener: efRcpConfig.sysCodeEvent;
constructor(codeEventListener: efRcpConfig.sysCodeEvent) {
this.codeEventListener = codeEventListener;
}
async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfSysCodeInterceptor.ets#L27-L71 | fa40df7f4ad012961749e46513f150cd7bbd76ae | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets | arkts | totalCount | TODO:知识点:获取懒加载数据源的数据长度 | totalCount(): number {
return this.faultMessage.length;
} | AST#method_declaration#Left totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Le... | totalCount(): number {
return this.faultMessage.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/DataSource.ets#L86-L88 | c2b02601c83d06293e7f5c4e79596579c3ac403f | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/search/BinarySearch.ets | arkts | findLastLessOrEqual | 查找最后一个小于等于目标值的元素
@param arr 已排序的数组
@param target 目标值
@returns 最后一个小于等于目标值的元素索引,如果不存在则返回-1 | public static findLastLessOrEqual(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
let result = -1;
while (left <= right) {
const mid = Math.floor((left + right) / 2);
if (arr[mid] <= target... | AST#method_declaration#Left public static findLastLessOrEqual AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left target : AST#type_... | public static findLastLessOrEqual(arr: number[], target: number): number {
if (!arr || arr.length === 0) {
return -1;
}
let left = 0;
let right = arr.length - 1;
let result = -1;
while (left <= right) {
const mid = Math.floor((left + right) / 2);
if (arr[mid] <= target... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/search/BinarySearch.ets#L131-L152 | d0a00000f1b6529169b0d5c78ae1cae9f2a627d4 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/XAxisRenderer.ets | arkts | computeAxisValues | @Override | protected computeAxisValues(min: number, max: number) {
if (this.mXAxis?.isDrawCustomLabels()) {
let labels = (this.mXAxis as XAxis)?.getCustomLabels();
this.mXAxis.mEntries = labels;
this.mXAxis.mCenteredEntries = labels;
this.mXAxis.mEntryCount = labels.length;
} else {
super.com... | AST#method_declaration#Left protected computeAxisValues AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#prima... | protected computeAxisValues(min: number, max: number) {
if (this.mXAxis?.isDrawCustomLabels()) {
let labels = (this.mXAxis as XAxis)?.getCustomLabels();
this.mXAxis.mEntries = labels;
this.mXAxis.mCenteredEntries = labels;
this.mXAxis.mEntryCount = labels.length;
} else {
super.com... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/XAxisRenderer.ets#L85-L95 | be2ddc900652c6bd66a123f57840db5722bd8788 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | getStats | 获取当前统计数据 | getStats(): OverallStats {
return { ...this.stats };
} | AST#method_declaration#Left getStats AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left OverallStats AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#L... | getStats(): OverallStats {
return { ...this.stats };
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L290-L292 | 56584753c717f8ed2aa1b0c88457ec8da36030ea | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/AnimateRefresh/entry/src/main/ets/pages/FileManagerIndex.ets | arkts | FileManagerIndex | File Management Entry. | @Component
export default struct FileManagerIndex {
@Provide(RefreshConstants.REFRESH_STATE_TAG) state: number = RefreshState.REFRESHING;
private deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display;
@Builder ContentBody() {
Image($r('app.media.bg_content'))
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct FileManagerIndex AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Provide ( AST#expression#Left AST#member_expression#Left AST#expression#Left RefreshConstants AST#expression#Right ... | @Component
export default struct FileManagerIndex {
@Provide(RefreshConstants.REFRESH_STATE_TAG) state: number = RefreshState.REFRESHING;
private deviceDisplay: display.Display = GlobalContext.getContext().getObject('display') as display.Display;
@Builder ContentBody() {
Image($r('app.media.bg_content'))
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/pages/FileManagerIndex.ets#L26-L64 | 5ba7f9697c2ac12430bba42cf55d298f4c6a1a75 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets | arkts | deleteAccountData | Delete account data.
@param {number} localId Account ID.
@param {DataRdb.RdbStore} rdbStore RDB database. | deleteAccountData(localId: number, rdbStore: DataRdb.RdbStore) {
let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_ACCOUNT);
predicates.equalTo(CommonConstants.FIELD_LOCAL_ID, localId);
rdbStore.delete(predicates).then(() => {
Logger.info(TAG, 'deleteAccountData d... | AST#method_declaration#Left deleteAccountData AST#parameter_list#Left ( AST#parameter#Left localId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_typ... | deleteAccountData(localId: number, rdbStore: DataRdb.RdbStore) {
let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_ACCOUNT);
predicates.equalTo(CommonConstants.FIELD_LOCAL_ID, localId);
rdbStore.delete(predicates).then(() => {
Logger.info(TAG, 'deleteAccountData d... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets#L97-L105 | 70599be83d7cec339efd852b8cfd071013b0c918 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | deleteTask | Delete a task
@param taskId - ID of task to delete | async deleteTask(taskId: number): Promise<void> {
try {
await this.rdbHelper.deleteTask(taskId);
await this.refreshData();
} catch (error) {
console.error(`[MainViewModel] Failed to delete task: ${JSON.stringify(error)}`);
}
} | AST#method_declaration#Left async deleteTask AST#parameter_list#Left ( AST#parameter#Left taskId : 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 ... | async deleteTask(taskId: number): Promise<void> {
try {
await this.rdbHelper.deleteTask(taskId);
await this.refreshData();
} catch (error) {
console.error(`[MainViewModel] Failed to delete task: ${JSON.stringify(error)}`);
}
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L495-L502 | 0015dd1618ede164e0ef9e47fd74184e4bdaa505 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/ui_tools.ets | arkts | Returns storage of named by the id.
@param id The id.
@returns The LocalStorage. | export function storage_of_id(id: string) {
let windowStorages = AppStorage.get('windowStorages') as LocalStorage[];
let idx = window_index_of_id(id);
return windowStorages[idx];
} | AST#export_declaration#Left export AST#function_declaration#Left function storage_of_id AST#parameter_list#Left ( AST#parameter#Left id : 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#s... | export function storage_of_id(id: string) {
let windowStorages = AppStorage.get('windowStorages') as LocalStorage[];
let idx = window_index_of_id(id);
return windowStorages[idx];
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L482-L486 | afe7426d6f8e69d5a5137ef9123738d9d0a7f37c | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/src/main/ets/components/SpinKit.ets | arkts | SpinKit | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01 | @ComponentV2
export struct SpinKit {
@Param spinSize: number = 36;
@Param spinColor: ResourceColor = Color.White;
@Param spinType: SpinType = SpinType.spinA;
build() {
if (this.spinType == SpinType.spinA) {
SpinA({ spinSize: this.spinSize, spinColor: this.spinColor })
} else if (this.spinType == ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinKit AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotat... | @ComponentV2
export struct SpinKit {
@Param spinSize: number = 36;
@Param spinColor: ResourceColor = Color.White;
@Param spinType: SpinType = SpinType.spinA;
build() {
if (this.spinType == SpinType.spinA) {
SpinA({ spinSize: this.spinSize, spinColor: this.spinColor })
} else if (this.spinType == ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinKit.ets#L49-L117 | 79648732e3739c37f23627488760696f77489d60 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/HomeViewModel.ets | arkts | loadHomeData | 加载首页数据
@returns {void} 无返回值 | loadHomeData(): void {
RequestHelper.repository<Home>(this.pageRepository.getHomeData())
.toast(false)
.execute()
.then((data: Home): void => {
const homeData: Home = new Home(data);
this.pageData = new Home(data);
this.listData = homeData.goods ?? [];
this.uiState ... | AST#method_declaration#Left loadHomeData 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#... | loadHomeData(): void {
RequestHelper.repository<Home>(this.pageRepository.getHomeData())
.toast(false)
.execute()
.then((data: Home): void => {
const homeData: Home = new Home(data);
this.pageData = new Home(data);
this.listData = homeData.goods ?? [];
this.uiState ... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/HomeViewModel.ets#L50-L66 | 60fb8548670aa700b10ebb6aabc0368601eff94c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | enableBluetooth | 开启蓝牙功能 | enableBluetooth() {
Log.showInfo(TAG, `enableBluetooth`);
try {
this.onBTStateChange();
access.enableBluetooth();
} catch (err) {
Log.showError(TAG, `enableBluetooth: err = ${err}`);
}
} | AST#method_declaration#Left enableBluetooth AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showInfo... | enableBluetooth() {
Log.showInfo(TAG, `enableBluetooth`);
try {
this.onBTStateChange();
access.enableBluetooth();
} catch (err) {
Log.showError(TAG, `enableBluetooth: err = ${err}`);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L56-L64 | e6aebe93e1977c6065c1066aeda51e0ad8e60253 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | getFilteredContacts | 获取筛选后的联系人列表 | private getFilteredContacts(): Contact[] {
let filteredContacts: Contact[] = this.allContacts;
// 按关系筛选
if (this.contactFilter !== 'all') {
filteredContacts = filteredContacts.filter((contact: Contact): boolean => {
// contact.relation是RelationType枚举值,直接与contactFilter比较
return contact... | AST#method_declaration#Left private getFilteredContacts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_d... | private getFilteredContacts(): Contact[] {
let filteredContacts: Contact[] = this.allContacts;
if (this.contactFilter !== 'all') {
filteredContacts = filteredContacts.filter((contact: Contact): boolean => {
return contact.relation === this.contactFilter;
});
}
if... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3982-L4003 | c67dd99902e52735796ff73bfd438bd6c67be957 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/VirtualEconomyService.ets | arkts | 道具稀有度枚举 | export enum ItemRarity {
COMMON = 'common',
UNCOMMON = 'uncommon',
RARE = 'rare',
EPIC = 'epic',
LEGENDARY = 'legendary',
MYTHICAL = 'mythical'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ItemRarity AST#enum_body#Left { AST#enum_member#Left COMMON = AST#expression#Left 'common' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left UNCOMMON = AST#expression#Left 'uncommon' AST#expression#Right AST#enum_member#Right , AST#enum_m... | export enum ItemRarity {
COMMON = 'common',
UNCOMMON = 'uncommon',
RARE = 'rare',
EPIC = 'epic',
LEGENDARY = 'legendary',
MYTHICAL = 'mythical'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/VirtualEconomyService.ets#L42-L49 | fb5068621c275b6e2f5ee5c88d067a653fc5665f | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api12/entry/src/main/ets/MainAbility/pages/Monitor/Monitor1.ets | arkts | TestSample | 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... | @ObservedV2
export class TestSample {
@Trace logRecord: string[] = []
@Trace res1: string = '测试1:fail'
@Trace res2: string = '测试2:fail'
@Trace res3: string = '测试3:fail'
@Trace res4: string = '测试4:fail'
@Trace res5: string = '测试5:fail'
} | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class TestSample AST#class_body#Left { AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right logRecord : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Ri... | @ObservedV2
export class TestSample {
@Trace logRecord: string[] = []
@Trace res1: string = '测试1:fail'
@Trace res2: string = '测试2:fail'
@Trace res3: string = '测试3:fail'
@Trace res4: string = '测试4:fail'
@Trace res5: string = '测试5:fail'
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api12/entry/src/main/ets/MainAbility/pages/Monitor/Monitor1.ets#L15-L23 | 8b23877acefc50fc0ddafafcc3ebfa1c07e55245 | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/url.ets | arkts | parseURL | ==================== 辅助工具函数 ==================== | function parseURL(urlString: string, base?: string): URLComponents | null {
try {
const url = new URL(urlString, base);
const components: URLComponents = {
href: url.href,
protocol: url.protocol,
username: url.username,
password: url.password,
... | AST#function_declaration#Left function parseURL AST#parameter_list#Left ( AST#parameter#Left urlString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left base ? : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | function parseURL(urlString: string, base?: string): URLComponents | null {
try {
const url = new URL(urlString, base);
const components: URLComponents = {
href: url.href,
protocol: url.protocol,
username: url.username,
password: url.password,
... | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L805-L826 | 989ca42096edf1ff0b29c8fab000adb99ad41746 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundHelper.ets | arkts | startDownloadOrGenerateSound | 启动下载或生成声音
@param text 要处理的文本
@returns 声音数据或null | static async startDownloadOrGenerateSound(text: string): Promise<CDBSound | null> {
return await CSoundManager.shared.getSound(text, true, true);
} | AST#method_declaration#Left static async startDownloadOrGenerateSound AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left... | static async startDownloadOrGenerateSound(text: string): Promise<CDBSound | null> {
return await CSoundManager.shared.getSound(text, true, true);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundHelper.ets#L20-L22 | 21afd041360886ae5bf8bf2270890f57093b51c3 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets | arkts | pickImages | 挑选图片 | async pickImages() {
try {
// 创建图片选择器实例
let photoPicker = new picker.PhotoViewPicker();
// 设置选择参数
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 9 - this.originalIm... | AST#method_declaration#Left async pickImages AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 创建图片选择器实例 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoPicker = AST#expressio... | async pickImages() {
try {
let photoPicker = new picker.PhotoViewPicker();
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 9 - this.originalImageUrls.length + this... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostEditPage.ets#L261-L303 | aed12f0bd23ced28e087176e7656ba8f2ac7ea24 | github |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/view/PublicFilesTab.ets | arkts | updateFileContent | private async updateFileContent() { if (!this.fileManager || !this.selectedFile) { console.error('更新文件内容参数不完整'); return; } try { // 直接调用 FileManager 的 updateFile 方法 const success = await this.fileManager.updateFile(this.selectedFile, this.fileContent); if (success) { console.log(`文件内容更新成功: ${this.selectedFile}`); //... | private async updateFileContent() {
if (!this.selectedFile || !this.fileContent) {
console.error('更新文件内容参数不完整');
return;
}
try {
console.log(`开始更新文件内容: ${this.selectedFile}`);
// 获取文件路径
const context = this.getUIContext().getHostContext() as Context;
const filesDir = co... | AST#method_declaration#Left private async updateFileContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expressio... | private async updateFileContent() {
if (!this.selectedFile || !this.fileContent) {
console.error('更新文件内容参数不完整');
return;
}
try {
console.log(`开始更新文件内容: ${this.selectedFile}`);
const context = this.getUIContext().getHostContext() as Context;
const filesDir = context.fil... | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/view/PublicFilesTab.ets#L356-L406 | 7e1dad5aa81b3a3a317f68f11815be67b9329497 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/pages/StyledText.ets | arkts | tabBuilder | 顶部tab | @Builder
tabBuilder(index: number, name: string | Resource) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? $r('app.color.styled_text_selected_tab_name') :
$r('app.color.styled_text_tab_name'))
.font({
weight: this.currentIndex === index ? FontWeight.Bold :... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilder 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#Left name : AST#type_annotation#Left AST... | @Builder
tabBuilder(index: number, name: string | Resource) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? $r('app.color.styled_text_selected_tab_name') :
$r('app.color.styled_text_tab_name'))
.font({
weight: this.currentIndex === index ? FontWeight.Bold :... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/pages/StyledText.ets#L124-L148 | 18faadedf9080c816d75afdadcea454c2a147bbf | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringEncrypt.ets | arkts | 加盐工具类,提供字符串加盐和去盐功能
用于增强字符串的安全性,防止简单解码 | export class SaltUtil {
// 盐值字符集,包含大小写字母和数字
private static readonly SALT_CHARS: string =
"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
/**
* 给字符串添加随机盐值
* @param str 要加盐的原始字符串,可为null
* @param saltCount 盐值字符数量,默认为2
* @returns 加盐后的字符串,如果输入为null... | AST#export_declaration#Left export AST#class_declaration#Left class SaltUtil AST#class_body#Left { // 盐值字符集,包含大小写字母和数字 AST#property_declaration#Left private static readonly SALT_CHARS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "abcdefgh... | export class SaltUtil {
private static readonly SALT_CHARS: string =
"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
static addSalt(str: string | null, saltCount: number = 2): string | null {
if (!str) {
return null;
}
let salt... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L170-L225 | 0d9e9bdf6d9d8cf4e3b44e828c29ae1ab81d2a90 | github | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/model/UserModel.ets | arkts | fromCloudObject | 从CloudDB对象创建PlayHistory | static fromCloudObject(obj: CloudDBZoneObject): PlayHistory {
const history = new PlayHistory(
obj.userId as number,
obj.songId as number,
obj.songTitle as string,
obj.songArtist as string
);
history.id = obj.id as string;
history.playedTime = obj.playedTime as number;
ret... | AST#method_declaration#Left static fromCloudObject AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left CloudDBZoneObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PlayHist... | static fromCloudObject(obj: CloudDBZoneObject): PlayHistory {
const history = new PlayHistory(
obj.userId as number,
obj.songId as number,
obj.songTitle as string,
obj.songArtist as string
);
history.id = obj.id as string;
history.playedTime = obj.playedTime as number;
ret... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L130-L140 | 34c36582ffe53be79c96cc5bb571898ba036d11e | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/detail/DetailCardsView.ets | arkts | autoPlaySound | 自动发音 | async autoPlaySound(){
///会员检查
if(!MemberManager.shared.checkAutoPronUsable(false)){
return;
}
// 单词 自动发音
if (SettingManager.shared.autoPlaySound) {
///播放一次
await AudioPlayer.shared.play(this.word.wordEnSoundText)
//播放2,3次
const pronTimes = SettingManager.shared.pron... | AST#method_declaration#Left async autoPlaySound AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { ///会员检查 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left... | async autoPlaySound(){
if(!MemberManager.shared.checkAutoPronUsable(false)){
return;
}
if (SettingManager.shared.autoPlaySound) {
await AudioPlayer.shared.play(this.word.wordEnSoundText)
const pronTimes = SettingManager.shared.pronTimes
if (pronTimes > 1) {... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detail/DetailCardsView.ets#L661-L695 | ab544ecc83899d665a63097e3d429a420b5e4153 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/enums/MessageType.ets | arkts | 消息类型枚举 | export enum MessageType {
//文本消息
TEXT = 0,
//语音消息
VOICE = 1
} | AST#export_declaration#Left export AST#enum_declaration#Left enum MessageType AST#enum_body#Left { //文本消息 AST#enum_member#Left TEXT = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , //语音消息 AST#enum_member#Left VOICE = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right } AST#enum_body#Ri... | export enum MessageType {
TEXT = 0,
VOICE = 1
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/enums/MessageType.ets#L17-L22 | 233a23a67dd3316c874335663d56415c955fdb89 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextReaderHelper.ets | arkts | init | 朗读控件初始化,用于初始化TTS引擎和底层播放器,初始化失败会返回对应错误码。
@param windowStage 窗口管理器
@param context 当前应用上下文
@param readParams 朗读参数
@param panelName 默认值为‘小艺朗读’,并且readParams为undefined该值才生效
@returns | static async init(windowStage: window.WindowStage, context: common.BaseContext,
readerParams?: TextReader.ReaderParam, panelName: string = '小艺朗读'): Promise<void> {
WindowManager.setWindowStage(windowStage);
if (readerParams === undefined || readerParams === null) {
const params: TextReader.ReaderParam... | AST#method_declaration#Left static async init AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context ... | static async init(windowStage: window.WindowStage, context: common.BaseContext,
readerParams?: TextReader.ReaderParam, panelName: string = '小艺朗读'): Promise<void> {
WindowManager.setWindowStage(windowStage);
if (readerParams === undefined || readerParams === null) {
const params: TextReader.ReaderParam... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L19-L30 | cdaddadb62b7f53aba7f3953500447e227625099 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets | arkts | addScheduleInfo | 新建日程页面 | @Builder
addScheduleInfo() {
Column({ space: COLUMN_SPACE }) {
Row() {
Text($r('app.string.calendar_switch_cancel'))
.fontSize($r('app.integer.calendar_switch_size_eighteen'))
.fontColor(Color.Red)
.onClick(() => {
this.isShow = false;
})
T... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right addScheduleInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_par... | @Builder
addScheduleInfo() {
Column({ space: COLUMN_SPACE }) {
Row() {
Text($r('app.string.calendar_switch_cancel'))
.fontSize($r('app.integer.calendar_switch_size_eighteen'))
.fontColor(Color.Red)
.onClick(() => {
this.isShow = false;
})
T... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets#L247-L461 | 2a2a681102594fd00807f5f663f703ef2a3eb7eb | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/Index.ets | arkts | CustomCalendarSamplePage | 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 { CustomCalendarSamplePage } from './src/main/ets/pages/CustomCalendarSample'; | AST#export_declaration#Left export { CustomCalendarSamplePage } from './src/main/ets/pages/CustomCalendarSample' ; AST#export_declaration#Right | export { CustomCalendarSamplePage } from './src/main/ets/pages/CustomCalendarSample'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/Index.ets#L16-L16 | 23efcf4ce2aa12ff5ccac188064d6fdf37e289ea | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets | arkts | getData | Returns data for the specified index location | public getData(index: number): number {
return this.dataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | public getData(index: number): number {
return this.dataArray[index];
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/PositiveOfLazyForEach.ets#L31-L33 | 619ece7ab85a6185671b603d2f70238934faa526 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/CommonTypes.ets | arkts | 应用主题枚举 | export enum ThemeMode {
LIGHT = 'light',
DARK = 'dark',
AUTO = 'auto'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ThemeMode AST#enum_body#Left { AST#enum_member#Left LIGHT = AST#expression#Left 'light' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DARK = AST#expression#Left 'dark' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ... | export enum ThemeMode {
LIGHT = 'light',
DARK = 'dark',
AUTO = 'auto'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/CommonTypes.ets#L37-L41 | 58c46bfe40de6e22eaefa6cde52e9e3924bc5a98 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets | arkts | 提醒时间 | constructor(title: string, location: string, startTime: Date, endTime: Date, describe: string,
dateString: string, reminderTime: number[]) {
this.title = title;
this.location = location;
this.startTime = startTime;
this.endTime = endTime;
this.describe = describe;
this.dateString = dateStrin... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left location : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | constructor(title: string, location: string, startTime: Date, endTime: Date, describe: string,
dateString: string, reminderTime: number[]) {
this.title = title;
this.location = location;
this.startTime = startTime;
this.endTime = endTime;
this.describe = describe;
this.dateString = dateStrin... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets#L70-L79 | b40a5972717dfef8cf4e8bb5bd0cf69fa29ba3b3 | gitee | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | products/entry/src/main/ets/model/Lifecycle2Model.ets | arkts | Lifecycle2Model | @author: HZWei
@date: 2024/11/8
@desc: 让一个类具有生命周期能力 ,实现ILifecycleObserver接口 | @Observed
export class Lifecycle2Model implements ILifecycleObserver {
private tag = 'LifecycleMgr2: '
loadState: string = "请求数据中..."
counter: number = 0
register(lifecycle: LifecycleRegistry) {
lifecycle.addObserver(this)
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Lifecycle2Model AST#implements_clause#Left implements ILifecycleObserver AST#implements_clause#Right AST#class_body#Left { AST#ERROR#Left private tag AST#ERROR#Left = AST#expression#Left 'LifecycleMgr2: ' AST#expression... | @Observed
export class Lifecycle2Model implements ILifecycleObserver {
private tag = 'LifecycleMgr2: '
loadState: string = "请求数据中..."
counter: number = 0
register(lifecycle: LifecycleRegistry) {
lifecycle.addObserver(this)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/model/Lifecycle2Model.ets#L10-L18 | 8e054f2e474c6a23a367bedb356610ca7d8787b3 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | 工具类 | export class Helper {
static readonly separator: string = '/';
/**
* 判断字符串是否为空(undefined、null)
* @param str 被检测的字符串
* @returns 是否为空
*/
static isNull(str: string | undefined | null): boolean {
return str === undefined || str === null;
}
/**
* 判断字符串是否为非空。true为非空空,否则false
* @param str
... | AST#export_declaration#Left export AST#class_declaration#Left class Helper AST#class_body#Left { AST#property_declaration#Left static readonly separator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/' AST#expression#Right ; AST#property_... | export class Helper {
static readonly separator: string = '/';
static isNull(str: string | undefined | null): boolean {
return str === undefined || str === null;
}
static isNotNull(str: string | undefined | null): boolean {
return false === Helper.isNull(str);
}
static isEmpty(str: strin... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L7-L411 | 4a5ff705d92b8fe6a4bf7eb8634e0cbf9ee71e77 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/models/ContactModel.ets | arkts | getValidationRules | 静态方法:获取验证规则 | private static getValidationRules(): ContactValidationRules {
return {
name: {
required: true,
minLength: 1,
maxLength: 50,
pattern: /^[\u4e00-\u9fa5a-zA-Z\s]+$/
},
phone: {
pattern: /^1[3-9]\d{9}$/,
required: false
},
email: {
pa... | AST#method_declaration#Left private static getValidationRules AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ContactValidationRules AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#e... | private static getValidationRules(): ContactValidationRules {
return {
name: {
required: true,
minLength: 1,
maxLength: 50,
pattern: /^[\u4e00-\u9fa5a-zA-Z\s]+$/
},
phone: {
pattern: /^1[3-9]\d{9}$/,
required: false
},
email: {
pa... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L394-L425 | c85c2113eef1160b5779f92f5520751046961ce7 | github |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/pages/RegisterPage.ets | arkts | onConfirm | @description: 修改用户信息
@date: 2024-01-10 23:01
@author wuwenqiang | onConfirm(index: number) {
this.userData.sex = index.toString();
this.dialogController?.close();
} | AST#method_declaration#Left onConfirm AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#L... | onConfirm(index: number) {
this.userData.sex = index.toString();
this.dialogController?.close();
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/pages/RegisterPage.ets#L370-L373 | 0334a7c134cc8968a84ede8b691148e2ab75c6b8 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/PasswordLogin.ets | arkts | verifyPassword | 密码识别 | verifyPassword() {
if (this.isAccountFrozen) {
promptAction.showToast({
message: '账号已冻结,无法登录',
duration: 2000,
});
return false;
}
if (this.account !== 'jay') {
promptAction.showToast({
message: '账号或密码错误',
duration: 2000,
});
return false;
... | AST#method_declaration#Left verifyPassword AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isAccountFrozen AST#member_expression#Right AST#expressi... | verifyPassword() {
if (this.isAccountFrozen) {
promptAction.showToast({
message: '账号已冻结,无法登录',
duration: 2000,
});
return false;
}
if (this.account !== 'jay') {
promptAction.showToast({
message: '账号或密码错误',
duration: 2000,
});
return false;
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/PasswordLogin.ets#L17-L40 | 4a85326e66df8c21a25b9a38ca4c4113d996acdd | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets | arkts | getImageSourceByArrayBuffer | 通过资源管理器获取资源文件(rawfile)的ArrayBuffer,再通过ArrayBuffer获取文件资源实例
@param fileName - 文件名称。
@returns 图片资源实例。 | public getImageSourceByArrayBuffer(fileName: string): Promise<image.ImageSource> {
// [Start pixelmap_get_resource_manager_in_arraybuffer]
const context: Context = getContext(this);
const resourceMgr: resourceManager.ResourceManager = context.resourceManager;
// [End pixelmap_get_resource_manager_in_arr... | AST#method_declaration#Left public getImageSourceByArrayBuffer AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | public getImageSourceByArrayBuffer(fileName: string): Promise<image.ImageSource> {
const context: Context = getContext(this);
const resourceMgr: resourceManager.ResourceManager = context.resourceManager;
return new Promise((resolve, reject) => {
resourceMgr.getRawFileContent(fi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/Decode.ets#L84-L106 | bcdf5ddfe5628eb0af3f78f4b9c325c8b63d1f7c | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getSectionOfWrangTimes | used for section title
@param wrangTimes 错误次数
@returns 区间名称 | static getSectionOfWrangTimes(wrangTimes: number): string | null {
if (wrangTimes === 1) {
return AppUtility.getNameOfMistake("Mistake_1_Only");
} else if (wrangTimes > 1 && wrangTimes <= 3) {
return AppUtility.getNameOfMistake("Mistake_1_3");
} else if (wrangTimes > 3 && wrangTimes <= 5) {
... | AST#method_declaration#Left static getSectionOfWrangTimes AST#parameter_list#Left ( AST#parameter#Left wrangTimes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#pri... | static getSectionOfWrangTimes(wrangTimes: number): string | null {
if (wrangTimes === 1) {
return AppUtility.getNameOfMistake("Mistake_1_Only");
} else if (wrangTimes > 1 && wrangTimes <= 3) {
return AppUtility.getNameOfMistake("Mistake_1_3");
} else if (wrangTimes > 3 && wrangTimes <= 5) {
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L138-L152 | 43d82737c3d9b673cbba0cb78dd9965ddf982ee6 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM4.ets | arkts | generateSymKeySync | 生成对称密钥SymKey,同步
@param symAlgName 待生成对称密钥生成器的算法名称(SM4_128)
@returns | static generateSymKeySync(): cryptoFramework.SymKey {
return CryptoUtil.generateSymKeySync('SM4_128');
} | AST#method_declaration#Left static generateSymKeySync AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#... | static generateSymKeySync(): cryptoFramework.SymKey {
return CryptoUtil.generateSymKeySync('SM4_128');
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L394-L396 | b3ac3ba45190f60fd25db1571c59c805694a2e84 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.