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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/TintImage.ets | arkts | parseColorString | 解析颜色字符串为归一化的 RGBA 数组
支持格式: #RGB, #RRGGBB, #AARRGGBB
@param colorStr 颜色字符串
@returns 归一化的 RGBA 数组 [R, G, B, A] | private parseColorString(colorStr: string): number[] {
let hex = colorStr.replace('#', '');
let r = 0, g = 0, b = 0, a = 1;
if (hex.length === 6) { // #RRGGBB
r = parseInt(hex.substring(0, 2), 16) / 255;
g = parseInt(hex.substring(2, 4), 16) / 255;
b = parseInt(hex.substring(4, 6), 16) / ... | AST#method_declaration#Left private parseColorString AST#parameter_list#Left ( AST#parameter#Left colorStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_ty... | private parseColorString(colorStr: string): number[] {
let hex = colorStr.replace('#', '');
let r = 0, g = 0, b = 0, a = 1;
if (hex.length === 6) {
r = parseInt(hex.substring(0, 2), 16) / 255;
g = parseInt(hex.substring(2, 4), 16) / 255;
b = parseInt(hex.substring(4, 6), 16) / 255;
}... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/TintImage.ets#L63-L91 | 0918af663d84299c351ceea2aac4df4fcd5233a0 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/CommonRepository.ets | arkts | getParam | 获取系统参数配置
@param key 参数键
@returns 系统参数配置值 | async getParam(key: string): Promise<NetworkResponse<string>> {
return this.networkDataSource.getParam(key);
} | AST#method_declaration#Left async getParam AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi... | async getParam(key: string): Promise<NetworkResponse<string>> {
return this.networkDataSource.getParam(key);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CommonRepository.ets#L27-L29 | c21b33fd401640503c10cc707319f895e3f2c23f | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets | arkts | makeLocalData | 本地mock数据生成朋友圈数据,推到momentData里 | async makeLocalData(): Promise<void> {
Logger.info(TAG, 'makeLocalData');
hiTraceMeter.startTrace(MAKE_LOCAL_DATA_TRACE, MAKE_LOCAL_DATA_TRACE_ID);
let friendMomentArray: Array<FriendMoment> = await getWebData(FriendMomentJsonUrl.FRIEND_MOMENT_JSON_URL[0]);
if (friendMomentArray) {
for (let i = 0;... | AST#method_declaration#Left async makeLocalData 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_ar... | async makeLocalData(): Promise<void> {
Logger.info(TAG, 'makeLocalData');
hiTraceMeter.startTrace(MAKE_LOCAL_DATA_TRACE, MAKE_LOCAL_DATA_TRACE_ID);
let friendMomentArray: Array<FriendMoment> = await getWebData(FriendMomentJsonUrl.FRIEND_MOMENT_JSON_URL[0]);
if (friendMomentArray) {
for (let i = 0;... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets#L112-L133 | 940951297a47ad3674b0574c4eef29a7ccfc9a92 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | setPreferredOrientation | 设置窗口的显示方向属性。该方法已过时,推荐使用:WindowUtil.setPreferredOrientation() | static async setPreferredOrientation(orientation: window.Orientation, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return WindowUtil.setPreferredOrientation(orientation, windowClass);
} | AST#method_declaration#Left static async setPreferredOrientation AST#parameter_list#Left ( AST#parameter#Left orientation : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Orientation AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#para... | static async setPreferredOrientation(orientation: window.Orientation, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return WindowUtil.setPreferredOrientation(orientation, windowClass);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L578-L580 | 4f2d2b88f7f5e37bb67a20f333e22c26a7f53f9e | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | go_home_onWorkingTab | Loads home link on the current main tab.
@description Will load url_default_blank() if the home_url of this bunch_of_tabs is not set. | go_home_onWorkingTab() {
let going_home_url = "";
if (bunch_of_tabs.home_url == undefined || bunch_of_tabs.home_url == "") {
going_home_url = url_default_blank();
} else {
going_home_url = bunch_of_tabs.home_url;
}
this.loadUrl_onWorkingTab(going_home_url);
} | AST#method_declaration#Left go_home_onWorkingTab AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left going_home_url = AST#expression#Left "" AST#expression#Right AST#variable_declarator#Right ; AST#variable_dec... | go_home_onWorkingTab() {
let going_home_url = "";
if (bunch_of_tabs.home_url == undefined || bunch_of_tabs.home_url == "") {
going_home_url = url_default_blank();
} else {
going_home_url = bunch_of_tabs.home_url;
}
this.loadUrl_onWorkingTab(going_home_url);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L73-L81 | 894975d587e317cd34a37e0ae1cc7406ca3c7e24 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets | arkts | getOrdinate | 根据进度拿到水位线的端点的纵坐标
@param progressPercent 进度百分比
@returns 水位线的端点的纵坐标 | getOrdinate(progressPercent: number): number {
return (Constants.UNIT_ONE - progressPercent) * (Constants.RADIUS_IN_PX + Constants.RADIUS_IN_PX);
} | AST#method_declaration#Left getOrdinate AST#parameter_list#Left ( AST#parameter#Left progressPercent : 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... | getOrdinate(progressPercent: number): number {
return (Constants.UNIT_ONE - progressPercent) * (Constants.RADIUS_IN_PX + Constants.RADIUS_IN_PX);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L66-L68 | 811665f2c6095034347df3254d1aa5c7111169e7 | gitee |
from-north-to-north/OpenHarmony_p7885 | f6ea526c039db535a7c958fa154ccfcb3668b37c | hap/easy_demo/float_windows/float_windows_3.5.15.23/entry/src/main/ets/controller/FloatWindowController.ets | arkts | createAndShowFloatWindow | 创建悬浮窗 | private async createAndShowFloatWindow(context: common.UIAbilityContext) {
if (context.isTerminating()) {
return;
}
console.info(TAG,` createAndShowWindow`);
let w = display.getDefaultDisplaySync().width;//获取屏幕宽度
let h = display.getDefaultDisplaySync().height;//获取屏幕宽度
// 创建应用子窗口
thi... | AST#method_declaration#Left private async createAndShowFloatWindow AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p... | private async createAndShowFloatWindow(context: common.UIAbilityContext) {
if (context.isTerminating()) {
return;
}
console.info(TAG,` createAndShowWindow`);
let w = display.getDefaultDisplaySync().width;
let h = display.getDefaultDisplaySync().height;
this.floatWindow = await wind... | https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/float_windows/float_windows_3.5.15.23/entry/src/main/ets/controller/FloatWindowController.ets#L60-L92 | 37dc8a3fb51c2cef7345b27685c72f58c6f242f0 | gitee |
xsdkhlgz/ATSOBJECT_OF_FIRST.git | 8c14e875d7ec3f418bb7cdaae123a8fea87a7e76 | entry/src/main/ets/pages/Page_of_First.ets | arkts | InputStyle | 和@Styles不同,@Extend仅支持定义在全局,不支持在组件内部定义。和@Styles不同,
@Extend支持封装指定组件的私有属性、私有事件和自身定义的全局方法。 | @Extend(TextInput)
function InputStyle(){
.placeholderColor('#99182431')
.height(45)
.fontSize(18)
.backgroundColor('#f1f3f5')
.width("100%")
.padding({ left:0 })
.margin({ top: 12 })
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextInput AST#expression#Right ) AST#decorator#Right function InputStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . placeholderColor ( AST#expression#L... | @Extend(TextInput)
function InputStyle(){
.placeholderColor('#99182431')
.height(45)
.fontSize(18)
.backgroundColor('#f1f3f5')
.width("100%")
.padding({ left:0 })
.margin({ top: 12 })
} | https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/pages/Page_of_First.ets#L10-L19 | 1dfe8982813ad55546961ad37753a39b736eb94e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | notifyDataMove | 通知LazyForEach组件将from索引和to索引处的子组件进行交换
@param {number} from - 起始值。
@param {number} to - 终点值。 | notifyDataMove(from: double, to: double): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left double AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left double AST#primary_type#Right... | notifyDataMove(from: double, to: double): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L139-L143 | f5647e3c0e378588c514640909d117dbe455f826 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | 日志是否启用开关 | export class logger {
static enable?: boolean;
} | AST#export_declaration#Left export AST#class_declaration#Left class logger AST#class_body#Left { AST#property_declaration#Left static enable ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_decla... | export class logger {
static enable?: boolean;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L341-L343 | 69aa9bff8f0dda93425faf15be9c1ab928c94462 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets | arkts | judgeHasNet | [End function_network_listen] | judgeHasNet(): boolean {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return false;
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
let cap = netCapability.networkCap || [];
if (cap.includes(connectio... | AST#method_declaration#Left judgeHasNet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AS... | judgeHasNet(): boolean {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return false;
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
let cap = netCapability.networkCap || [];
if (cap.includes(connectio... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L101-L123 | e32151b2efbda7b487ce23442a708acee5992620 | gitee |
AlatusLee/HarmonyOS-Next-Weather-Assistant.git | d3c7060a8ff7f7656175e83fa32536b11e136556 | alatus/src/main/ets/viewmodel/getWeatherUtil.ets | arkts | getWeather | 发送一个URL请求,返回对应的数据 | getWeather(cityCode:number){
return new Promise<weatherModel>((resolve,reject)=>{
let request = http.createHttp();
let url = `https://restapi.amap.com/v3/weather/weatherInfo?city=${cityCode}&extensions=all&key=${key}`;
let result = request.request(url);
result.then((res)=>{
if(res.re... | AST#method_declaration#Left getWeather AST#parameter_list#Left ( AST#parameter#Left cityCode : 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#block_statement#Left { AST#statement#Left AST#return_statement#Left ret... | getWeather(cityCode:number){
return new Promise<weatherModel>((resolve,reject)=>{
let request = http.createHttp();
let url = `https://restapi.amap.com/v3/weather/weatherInfo?city=${cityCode}&extensions=all&key=${key}`;
let result = request.request(url);
result.then((res)=>{
if(res.re... | https://github.com/AlatusLee/HarmonyOS-Next-Weather-Assistant.git/blob/d3c7060a8ff7f7656175e83fa32536b11e136556/alatus/src/main/ets/viewmodel/getWeatherUtil.ets#L7-L20 | 8453ce623bf1323ad8480361aac62c5c01b76be0 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PermissionUtil.ets | arkts | requestPermissionsEasy | 申请授权,拒绝后并二次向用户申请授权(申请权限,建议使用该方法)。
@param permissions
@returns | static async requestPermissionsEasy(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
const ps: Array<Permissions> = Array.isArray(permissions) ? [...permission... | AST#method_declaration#Left static async requestPermissionsEasy AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Permissions AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotati... | static async requestPermissionsEasy(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
const ps: Array<Permissions> = Array.isArray(permissions) ? [...permission... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L82-L94 | 29e3b1898402cc9c2f233c60d46d93d72d1ead27 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | Reader Iterator Result
@interface ReaderIteratorResult
@syscap SystemCapability.FileManagement.File.FileIO
@since 20 | export interface ReaderIteratorResult {
/**
* Whether reader iterator completes the traversal.
*
* @type { boolean }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/
done: boolean;
/**
* The value of reader iterator.
*
* @type { string }
* @syscap SystemCapabil... | AST#export_declaration#Left export AST#interface_declaration#Left interface ReaderIteratorResult AST#object_type#Left { /**
* Whether reader iterator completes the traversal.
*
* @type { boolean }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/ AST#type_member#Left done : AST#typ... | export interface ReaderIteratorResult {
done: boolean;
value: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4215-L4233 | 6af4e54f419ddbde6afa3814f42e930208c5fd95 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/Index.ets | arkts | DemoGraph | @file demo 模块统一导出
@author Joker.X | export { DemoGraph } from "./src/main/ets/navigation/DemoGraph"; | AST#export_declaration#Left export { DemoGraph } from "./src/main/ets/navigation/DemoGraph" ; AST#export_declaration#Right | export { DemoGraph } from "./src/main/ets/navigation/DemoGraph"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/Index.ets#L6-L6 | f678060c985a0a7c5e9c7663b72733807c202282 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets | arkts | getGoodsPage | 分页查询商品
@param params 商品搜索请求参数
@returns 商品分页数据响应 | async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Goods>>> =
await NetworkClient.http.post("goods/info/page", params);
return resp.data;
} | AST#method_declaration#Left async getGoodsPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GoodsSearchRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene... | async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Goods>>> =
await NetworkClient.http.post("goods/info/page", params);
return resp.data;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets#L18-L22 | 474d06c029b12e68dbac967bcc91e4fa40a17bb5 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/components/SpeedDialog.ets | arkts | SpeedDialog | 倍速列表索引 | @CustomDialog
export struct SpeedDialog {
@State speedList: Resource[] = [$r('app.string.video_speed_1_0X'), $r('app.string.video_speed_1_25X'), $r('app.string.video_speed_1_75X'), $r('app.string.video_speed_2_0X')];
@Link speedSelect: number; // 当前选择项的索引
@StorageLink('avPlayManage') avPlayManage: avPlayManage = ... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct SpeedDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right speedList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#arr... | @CustomDialog
export struct SpeedDialog {
@State speedList: Resource[] = [$r('app.string.video_speed_1_0X'), $r('app.string.video_speed_1_25X'), $r('app.string.video_speed_1_75X'), $r('app.string.video_speed_2_0X')];
@Link speedSelect: number;
@StorageLink('avPlayManage') avPlayManage: avPlayManage = new avPlayM... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/VideoPlay/entry/src/main/ets/components/SpeedDialog.ets#L23-L118 | 1affa44177886445ea54658563259d19821b7259 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/MainDialog.ets | arkts | mainDialog | 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... | @CustomDialog
export struct mainDialog {
controller: CustomDialogController;
async aboutToAppear() {
console.info(`Camera aboutToAppear entry`);
}
build() {
Column() {
Column() {
Text($r('app.string.ALLOW_WLAN'))
.fontSize(16)
.fontFamily('HarmonyHeiTi')
.fo... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct mainDialog AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ; AST#property_... | @CustomDialog
export struct mainDialog {
controller: CustomDialogController;
async aboutToAppear() {
console.info(`Camera aboutToAppear entry`);
}
build() {
Column() {
Column() {
Text($r('app.string.ALLOW_WLAN'))
.fontSize(16)
.fontFamily('HarmonyHeiTi')
.fo... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/MainDialog.ets#L16-L103 | ac8bf6280d4e2ae7a00435ff6711687db8efa391 | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/pages/InitView.ets | arkts | checkSingleItem | 检查单个项目 | async checkSingleItem(itemId: string, index: number) {
try {
const result = await this.performCheck(itemId);
// 创建新的数组来触发@State更新
const newCheckItems: CheckItem[] = [...this.checkItems];
const currentItem = newCheckItems[index];
const updatedItem: CheckItem = {
id: curre... | AST#method_declaration#Left async checkSingleItem AST#parameter_list#Left ( AST#parameter#Left itemId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | async checkSingleItem(itemId: string, index: number) {
try {
const result = await this.performCheck(itemId);
const newCheckItems: CheckItem[] = [...this.checkItems];
const currentItem = newCheckItems[index];
const updatedItem: CheckItem = {
id: currentItem.id,
n... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/InitView.ets#L112-L162 | b25167ac6e3ab2c32c39b5db7ddac9a54920a5f3 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/view/StarfieldComponent.ets | arkts | startTwinkleAnimation | 启动闪烁动画 | private startTwinkleAnimation(): void {
let frame = 0;
this.animationTimer = setInterval(() => {
frame++;
const newStars: Star[] = [];
for (let i = 0; i < this.stars.length; i++) {
const star = this.stars[i];
const newOpacity = 0.5 + Math.sin(frame * star.twinkleSpeed + star.tw... | AST#method_declaration#Left private startTwinkleAnimation 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 let AST#variable_declarator#Le... | private startTwinkleAnimation(): void {
let frame = 0;
this.animationTimer = setInterval(() => {
frame++;
const newStars: Star[] = [];
for (let i = 0; i < this.stars.length; i++) {
const star = this.stars[i];
const newOpacity = 0.5 + Math.sin(frame * star.twinkleSpeed + star.tw... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/StarfieldComponent.ets#L55-L76 | e306a2e99a09729f3327b7cc5a483b066a90eefd | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/citysearch/src/main/ets/view/SearchView.ets | arkts | SearchView | 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... | @Component
export struct SearchView {
// List组件里可以绑定的可滚动组件的控制器
private scroller: Scroller = new Scroller();
// 搜索列表
@Link searchList: string[];
// 选定的城市
@Link changeValue: string;
build() {
Stack({ alignContent: Alignment.TopEnd }) {
List({ space: 14, initialIndex: 0, scroller: this.scroller })... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SearchView AST#component_body#Left { // List组件里可以绑定的可滚动组件的控制器 AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right =... | @Component
export struct SearchView {
private scroller: Scroller = new Scroller();
@Link searchList: string[];
@Link changeValue: string;
build() {
Stack({ alignContent: Alignment.TopEnd }) {
List({ space: 14, initialIndex: 0, scroller: this.scroller }) {
ForEach(this.searchList, (it... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/view/SearchView.ets#L16-L56 | 1ee4b49a32d95f0cc3803a4a66b639077b2f4b11 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/Index.ets | arkts | AuthRepository | @file data 模块统一导出
@author Joker.X | export { AuthRepository } from './src/main/ets/repository/AuthRepository'; | AST#export_declaration#Left export { AuthRepository } from './src/main/ets/repository/AuthRepository' ; AST#export_declaration#Right | export { AuthRepository } from './src/main/ets/repository/AuthRepository'; | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/Index.ets#L6-L6 | ea4c5a99856f978671104c994d82866f37e16ef3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | getIndicatorHeight | 获取底部导航条的高度,单位为vp。
@returns | static getIndicatorHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHelper.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
.top... | AST#method_declaration#Left static getIndicatorHeight AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_... | static getIndicatorHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHelper.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
.top... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L172-L187 | 7b2c9a3ecc5690908013a72912001b9e5f77b39f | gitee |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/utils/MqttUtil.ets | arkts | createClient | 创建客户端 | private async createClient(): Promise<void> {
if (this.mqttConfig === undefined) {
console.warn('未加载配置文件')
return;
}
const url = `ssl://${this.mqttConfig.host}:${this.mqttConfig.port}`;
this.mqttClient = MqttAsync.createMqtt({
url: url,
clientId: this.mqttConfig.clientId,
... | AST#method_declaration#Left private async createClient 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 createClient(): Promise<void> {
if (this.mqttConfig === undefined) {
console.warn('未加载配置文件')
return;
}
const url = `ssl://${this.mqttConfig.host}:${this.mqttConfig.port}`;
this.mqttClient = MqttAsync.createMqtt({
url: url,
clientId: this.mqttConfig.clientId,
... | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/MqttUtil.ets#L65-L77 | 55e741bdbfab20ec3af89471ac6e654bfeeeb6d0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpdfviewer/Index.ets | arkts | WebPDFViewerComponent | 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 { WebPDFViewerComponent } from './src/main/ets/view/WebPDFViewer'; | AST#export_declaration#Left export { WebPDFViewerComponent } from './src/main/ets/view/WebPDFViewer' ; AST#export_declaration#Right | export { WebPDFViewerComponent } from './src/main/ets/view/WebPDFViewer'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpdfviewer/Index.ets#L15-L15 | ac5deb85aeb63d474fa758b4e26bf060c19677f9 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | setWindowFocusable | 设置使用点击或其他方式使该窗口获焦的场景时,该窗口是否支持窗口焦点从点击前的获焦窗口切换到该窗口,使用Promise异步回调。
@param isFocusable 点击时是否支持切换焦点窗口。true表示支持;false表示不支持。
@param windowClass 不传该值,默认主窗口。
@returns | static async setWindowFocusable(isFocusable: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setWindowFocusable(isFocusable);
} | AST#method_declaration#Left static async setWindowFocusable AST#parameter_list#Left ( AST#parameter#Left isFocusable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#... | static async setWindowFocusable(isFocusable: boolean,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setWindowFocusable(isFocusable);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L253-L256 | 14e29e18fe523aebf5dbbaf1901011a56696d98c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | isSameDay | 是否是同一日 | static isSameDay(selectDate: Date, date: Date): boolean {
return DateHelper.isSameMonth(selectDate, date) && selectDate.getDate() == date.getDate();
} | AST#method_declaration#Left static isSameDay AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type... | static isSameDay(selectDate: Date, date: Date): boolean {
return DateHelper.isSameMonth(selectDate, date) && selectDate.getDate() == date.getDate();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L130-L132 | 7936f2f9ca82c7bef0c899766abd20ff87457cde | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets | arkts | typeMultiFilter | 仅选择套餐类型
@param changData | public typeMultiFilter(changData: Array<string>) {
let siteListString: string | undefined = AppStorage.get('siteList');
if (siteListString) {
let siteListObject: SiteListDataSource | undefined = JSON.parse(siteListString);
if (siteListObject === undefined) {
return;
}
this.initia... | AST#method_declaration#Left public typeMultiFilter AST#parameter_list#Left ( AST#parameter#Left changData : 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#ty... | public typeMultiFilter(changData: Array<string>) {
let siteListString: string | undefined = AppStorage.get('siteList');
if (siteListString) {
let siteListObject: SiteListDataSource | undefined = JSON.parse(siteListString);
if (siteListObject === undefined) {
return;
}
this.initia... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteListDataSource.ets#L111-L137 | 58c38961e43d4080389c3d3b259ca082694185a0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets | arkts | if | 获取视频宽高比 | if (this.avPlayer.width >= this.avPlayer.height) { // 判断是横屏视频还是竖屏视频
this.verticalVideo = false;
} | AST#method_declaration#Left if AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . avPlayer . width >= this . avPlayer . height AST#ERROR#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 判断是横屏视频还是竖屏视频 AST#expression_statement#Left AST#expression#Left AST#assignment... | if (this.avPlayer.width >= this.avPlayer.height) {
this.verticalVideo = false;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets#L268-L270 | 55e582d8a74c496223e4c99f8919529f72a8641c | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/common/CustomDialogController.ets | arkts | CustomDialogControllerExample | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @CustomDialog
export struct CustomDialogControllerExample {
@Link textValue: string
@Link inputValue: string
controller?: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text('Change text').fontSize(20).margin({ top: 10, bottom: 10 })... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CustomDialogControllerExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | @CustomDialog
export struct CustomDialogControllerExample {
@Link textValue: string
@Link inputValue: string
controller?: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text('Change text').fontSize(20).margin({ top: 10, bottom: 10 })... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/common/CustomDialogController.ets#L16-L53 | 2444b4acddeb1c02af5b1b96969aa173a5372ccb | gitee |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/AddAccount.ets | arkts | saveAccount | Save account | saveAccount() {
console.info('=== saveAccount called ===');
console.info('accountName:', this.accountName);
if (!this.accountName) {
console.warn('Account name is empty');
promptAction.showToast({
message: '请输入账户名称',
duration: 2000
});
return;
}
cons... | AST#method_declaration#Left saveAccount 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 console AST#expression#Right . info AST... | saveAccount() {
console.info('=== saveAccount called ===');
console.info('accountName:', this.accountName);
if (!this.accountName) {
console.warn('Account name is empty');
promptAction.showToast({
message: '请输入账户名称',
duration: 2000
});
return;
}
cons... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddAccount.ets#L276-L345 | da8a9735e037147bd8f79f0b1044006d3394edb8 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/BookHistory.ets | arkts | BookHistory | @author 2008
@datetime 2024/8/5 21:15
@className: BookHistory
书籍浏览历史 | @Observed
export class BookHistory {
id?:number
// 书籍名称
bookName:string = ''
// 作者名称
author: string = ''
//阅读地址
bookUrl:string = ''
//封面地址
coverUrl:string = ''
//最近一次阅读书籍的时间(打开正文的时间)
durChapterTime:number = 0
//最近一次阅读章节的序号
durChapterIndex:number = 0
//最近一次阅读章节的标题
durChapterTitle:string = '... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class BookHistory AST#class_body#Left { AST#property_declaration#Left id ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right // 书籍名称 AST#ERROR#Left bookName : string = AS... | @Observed
export class BookHistory {
id?:number
bookName:string = ''
author: string = ''
bookUrl:string = ''
coverUrl:string = ''
durChapterTime:number = 0
durChapterIndex:number = 0
durChapterTitle:string = ''
durChapterContent:string = ''
sort:number = 0
bookType?:n... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/BookHistory.ets#L7-L50 | 987b45a26475ba9772323acc33c928c33112a77f | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getPluralStringValueSync | 根据指定数量获取指定resource对象表示的单复数字符串
@param resId 资源ID值/资源信息
@param num 数量值 | static getPluralStringValueSync(resId: number | Resource, num: number): string {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getPluralStringValueSync(resId, num);
} else {
return ResUtil.getResourceManager().getPluralStringValueSync(resId, num);
}
} | AST#method_declaration#Left static getPluralStringValueSync AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#par... | static getPluralStringValueSync(resId: number | Resource, num: number): string {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getPluralStringValueSync(resId, num);
} else {
return ResUtil.getResourceManager().getPluralStringValueSync(resId, num);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L192-L198 | dec53cd2a18d517dfca886f60b45fe5a276a2e0f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageloading/src/main/ets/mock/CommodityMock.ets | arkts | 商品列表数据源 | export const PRODUCTS_DATA: Array<CommodityDataModel> = [
new CommodityDataModel(0, $r("app.media.page_loading_commodity00"), $r("app.string.page_loading_commodity_title00"), $r("app.string.page_loading_commodity_price00"), $r("app.string.page_loading_commodity_view00"), $r("app.string.page_loading_commodity_insuranc... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PRODUCTS_DATA : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CommodityDataModel AST#primary_type#Right AST#type_annot... | export const PRODUCTS_DATA: Array<CommodityDataModel> = [
new CommodityDataModel(0, $r("app.media.page_loading_commodity00"), $r("app.string.page_loading_commodity_title00"), $r("app.string.page_loading_commodity_price00"), $r("app.string.page_loading_commodity_view00"), $r("app.string.page_loading_commodity_insuranc... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageloading/src/main/ets/mock/CommodityMock.ets#L21-L28 | 655669eb7864df14bb28782c701c0d8a7b4bec07 | gitee | |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/SettingsStorage.ets | arkts | 初始化设置存储 | export function initializeSettings(ctx?: common.Context) {
instance = getDiskStorageInstance("settings", ctx);
if (!instance) {
throw new Error("Failed to initialize settings storage");
}
} | AST#export_declaration#Left export AST#function_declaration#Left function initializeSettings AST#parameter_list#Left ( AST#parameter#Left ctx ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramete... | export function initializeSettings(ctx?: common.Context) {
instance = getDiskStorageInstance("settings", ctx);
if (!instance) {
throw new Error("Failed to initialize settings storage");
}
} | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L7-L12 | b04955834c6c47add165f8512de0388879a23555 | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | setTextStyle | Sets the color of the value-text that is drawn next to the LimitLine.
Default: Paint.Style.FILL_AND_STROKE
@param style | public setTextStyle(style: Style) {
this.mTextStyle = style;
} | AST#method_declaration#Left public setTextStyle AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left Style 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... | public setTextStyle(style: Style) {
this.mTextStyle = style;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L150-L152 | 5b752cbe6084a75c27a3418292c9b801d12e095a | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FormatUtil.ets | arkts | getQueryValue | 获取url里的参数,Key对应的Value
@param url
@param key
@returns | static getQueryValue(url: string, key: string): string {
const urlObj = OsUrl.URL.parseURL(url);
const value = urlObj.params.get(key);
return value || "";
} | AST#method_declaration#Left static getQueryValue AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static getQueryValue(url: string, key: string): string {
const urlObj = OsUrl.URL.parseURL(url);
const value = urlObj.params.get(key);
return value || "";
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L158-L162 | 75f78021a55d0f3e801a1b59809baadd520fd588 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ImageViewer/entry/src/main/ets/picturepreviewsample/PicturePreviewSample.ets | arkts | PicturePreviewSample | 图片预览使用案例
功能说明:本示例介绍使用List、LazyForEach、matrix4、组合手势实现图片预览功能
推荐场景:需要图片预览的场景
核心组件:
1. PicturePreview:实现图片预览的布局和循环设置多图预览
2. PicturePreviewImage : 具体某个图片预览
实现步骤:
1. 数据准备:首先构建一个需要预览的图片数组
@example
@State imageList: string[] = [$r("app.media.picturepreview_image")];
2. 数据准备:创建好主轴方向
@example
@State listDirection: Axis = Axi... | @Component
export struct PicturePreviewSample {
@State imageList: string[] = [];
@State listDirection: Axis = Axis.Horizontal;
aboutToAppear(): void {
let imageSource:string = $r('app.media.picturepreview_image') as ESObject;
this.imageList.push(
imageSource,
imageSource,
imageSource
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PicturePreviewSample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imageList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST... | @Component
export struct PicturePreviewSample {
@State imageList: string[] = [];
@State listDirection: Axis = Axis.Horizontal;
aboutToAppear(): void {
let imageSource:string = $r('app.media.picturepreview_image') as ESObject;
this.imageList.push(
imageSource,
imageSource,
imageSource
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/picturepreviewsample/PicturePreviewSample.ets#L39-L56 | 924db6529ffdafa85a48c491df1de3ea89253328 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/components/AddressService.ets | arkts | AddressService | Copyright (c) 2022-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,... | @Component
export struct AddressService {
@Link isPanel: boolean;
@Link currentLocation: string;
@Builder
Server(text: Resource, marginTop: number) {
Row() {
Image($r('app.media.service'))
.objectFit(ImageFit.Contain)
.width(16)
.aspectRatio(1)
Row() {
Text(text... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AddressService AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isPanel : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_ann... | @Component
export struct AddressService {
@Link isPanel: boolean;
@Link currentLocation: string;
@Builder
Server(text: Resource, marginTop: number) {
Row() {
Image($r('app.media.service'))
.objectFit(ImageFit.Contain)
.width(16)
.aspectRatio(1)
Row() {
Text(text... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/components/AddressService.ets#L16-L108 | 97a48eb45893937a739ce6b7bc9bf77f6529fb75 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/picker/colorpicer/ColorPickerView.ets | arkts | 组件构建函数,返回颜色选择器UI结构 | build() {
// 垂直排列颜色行,行间距8vp
Column({ space: 8 }) {
// 遍历每一行颜色数组
ForEach(this.isUseSimpleColor ? this.colorMatrix2 : this.colorMatrix, (row: string[], rowIndex: number) => {
// 每行水平排列颜色圆圈,圆圈间距8vp
Row({ space: 8 }) {
// 遍历行内每个颜色,渲染圆圈
ForEach(row, (color: string, col... | AST#build_method#Left build ( ) AST#build_body#Left { // 垂直排列颜色行,行间距8vp 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 8 AST#expression#Right AST#component_parameter#Right } AST#componen... | build() {
Column({ space: 8 }) {
ForEach(this.isUseSimpleColor ? this.colorMatrix2 : this.colorMatrix, (row: string[], rowIndex: number) => {
Row({ space: 8 }) {
ForEach(row, (color: string, colIndex: number) => {
Rect()
.width(this.i... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/picker/colorpicer/ColorPickerView.ets#L37-L64 | b4bd5397bfc5e18e5fab29db4c761808f48342a7 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/dynamicImport/Index.ets | arkts | DynamicHome | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { DynamicHome } from './src/main/ets/pages/DynamicHome' | AST#export_declaration#Left export { DynamicHome } from './src/main/ets/pages/DynamicHome' AST#export_declaration#Right | export { DynamicHome } from './src/main/ets/pages/DynamicHome' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/dynamicImport/Index.ets#L15-L15 | 325e5dd07500d94a66a18ca197f00ccb212de119 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/card/Card.ets | arkts | Card | @file 通用卡片容器组件
@author Joker.X | @ComponentV2
export struct Card {
/**
* 宽度
*/
@Param
widthValue: Length | undefined = P100;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 背景色
*/
@Param
bgColor: ResourceColor = $r("app.color.bg_white");
/**
* 圆角大小
*/
@Param
radiusValue: Length = $r... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct Card AST#component_body#Left { /**
* 宽度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right widthValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AS... | @ComponentV2
export struct Card {
@Param
widthValue: Length | undefined = P100;
@Param
heightValue: Length | undefined = undefined;
@Param
bgColor: ResourceColor = $r("app.color.bg_white");
@Param
radiusValue: Length = $r("app.float.radius_medium");
@Param
paddingValue: Padding | Leng... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/card/Card.ets#L7-L64 | 8f0e11b50ea69e6bd375c12a067aae5b3c6a980b | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets | arkts | selectKey | 选择私钥文件 | selectKey() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
keyFileUri = result[0]
this.msgHistory += "select file: " + keyFileUri + "\r\n";
this.keyCanLoad = true
}
}).catch((e) => {
this.m... | AST#method_declaration#Left selectKey AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#express... | selectKey() {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
if (result.length > 0) {
keyFileUri = result[0]
this.msgHistory += "select file: " + keyFileUri + "\r\n";
this.keyCanLoad = true
}
}).catch((e) => {
this.m... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/Tls2Way/entry/src/main/ets/pages/Index.ets#L295-L306 | 738e42d681a49a537e127ccaa1702779060b8cda | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/FavoritesService.ets | arkts | estimateCost | 估算成本 | private estimateCost(totalTokens: number): number {
// 简单估算:假设每1000个token成本0.01元
return (totalTokens / 1000) * 0.01;
} | AST#method_declaration#Left private estimateCost AST#parameter_list#Left ( AST#parameter#Left totalTokens : 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#pr... | private estimateCost(totalTokens: number): number {
return (totalTokens / 1000) * 0.01;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L428-L431 | 55d56c14d2511562e695721491b6859e3ec34cad | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets | arkts | showRecord | 调用统计图样式 | @Builder
showRecord(type:string){
if(type==='day'){
this.practiceGraphType('day',this.workoutDayData,true,120,200);
this.practiceGraphType('day',this.workoutDayData,false,120,200);
}else if(type==='week'){
this.practiceGraphType('week',this.workoutWeekData,true,840,1400);
this.practice... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right showRecord AST#parameter_list#Left ( AST#parameter#Left type : 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... | @Builder
showRecord(type:string){
if(type==='day'){
this.practiceGraphType('day',this.workoutDayData,true,120,200);
this.practiceGraphType('day',this.workoutDayData,false,120,200);
}else if(type==='week'){
this.practiceGraphType('week',this.workoutWeekData,true,840,1400);
this.practice... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets#L88-L103 | 5b79288fbef595b67bb9ea3e3959fe14f450fbbe | github |
Glace-Dev/Harmony_Projects.git | 845cef3c5fdf5d049c942fe62cbf083c2c78e84a | basis/entry/src/main/ets/pages/PropPage.ets | arkts | card | 统一的卡片样式 | @Styles function card() {
.width('95%')
.padding(20)
.backgroundColor(Color.White)
.borderRadius(15)
.shadow({ radius: 6, color: '#1F000000', offsetX: 2, offsetY: 4 })
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function card AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left '95%' AST#expression#Right ) AST#modifier_chain_expression#Left . pa... | @Styles function card() {
.width('95%')
.padding(20)
.backgroundColor(Color.White)
.borderRadius(15)
.shadow({ radius: 6, color: '#1F000000', offsetX: 2, offsetY: 4 })
} | https://github.com/Glace-Dev/Harmony_Projects.git/blob/845cef3c5fdf5d049c942fe62cbf083c2c78e84a/basis/entry/src/main/ets/pages/PropPage.ets#L13-L19 | b55a5d48a043e84eda56c35e347319c86a3bae99 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/widgets/pages/WidgetCard4x4.ets | arkts | buildHeader | 构建头部 | @Builder
buildHeader() {
Row() {
Image($r('app.media.ic_birthday_cake'))
.width(24)
.height(24)
.fillColor($r('app.color.primary'))
Text('生日提醒助手')
.fontSize(18)
.fontColor($r('app.color.text_primary'))
.fontWeight(FontWeight.Medium)
.layoutWeigh... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Image($r('app.media.ic_birthday_cake'))
.width(24)
.height(24)
.fillColor($r('app.color.primary'))
Text('生日提醒助手')
.fontSize(18)
.fontColor($r('app.color.text_primary'))
.fontWeight(FontWeight.Medium)
.layoutWeigh... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/widgets/pages/WidgetCard4x4.ets#L52-L73 | fe13c2aee51470d532a643606fc61f841451f85b | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/A1Z26Cipher.ets | arkts | encrypt | 将文本转换为数字序列
@param text 要加密的文本
@param separator 数字之间的分隔符
@returns 加密后的数字序列 | static encrypt(text: string, separator: string = '-'): string {
if (!text) {
return '';
}
return text.toUpperCase().split('').map(char => {
if (char >= 'A' && char <= 'Z') {
return (char.charCodeAt(0) - 64).toString();
}
return char;
}).join(separator);
} | AST#method_declaration#Left static encrypt 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 separator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ... | static encrypt(text: string, separator: string = '-'): string {
if (!text) {
return '';
}
return text.toUpperCase().split('').map(char => {
if (char >= 'A' && char <= 'Z') {
return (char.charCodeAt(0) - 64).toString();
}
return char;
}).join(separator);
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/A1Z26Cipher.ets#L12-L23 | 52c4a918cf3074f25eab74fe650b0472b6adff56 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Window/MediaFullScreen/entry/src/main/ets/pages/MediaFullScreen.ets | arkts | MediaFullScreenComponent | 组件zIndex
功能描述: 本示例介绍了使用@ohos.multimedia.media接口和@ohos.window接口配合XComponent组件实现媒体全屏的功能。
推荐场景: 多用于首页瀑布流媒体播放等场景
核心组件:
1. window
2. XComponent
实现步骤:
1. 在自定义组件XVideoComponent内调用changeOrientation方法,实现媒体全屏效果。
2. 调用@ohos.window的getLastWindow方法获取当前应用内最上层的子窗口,若无应用子窗口,则返回应用主窗口。
3. 利用获取到的窗口对象,调用setWindowSystemBarEnable方法设置窗口是否... | @Entry
@Component
export struct MediaFullScreenComponent {
@State maskShow: boolean = false; // 遮罩层是否显示
@State isLandscape: boolean = false; // 是否横屏状态
@State cachedCountNumber: number = 6; // 懒加载缓存数
@State contentData: FlowItemContentsData = new FlowItemContentsData(); // 瀑布流内容
@State selectedVideo: string = ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct MediaFullScreenComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right maskShow : AST#type_annotation#Left AST#pr... | @Entry
@Component
export struct MediaFullScreenComponent {
@State maskShow: boolean = false;
@State isLandscape: boolean = false;
@State cachedCountNumber: number = 6;
@State contentData: FlowItemContentsData = new FlowItemContentsData();
@State selectedVideo: string = '';
@State videoLocation: Area = ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Window/MediaFullScreen/entry/src/main/ets/pages/MediaFullScreen.ets#L43-L126 | a926b3b4f15932613765031e602fbcb5cfb1f901 | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/common/utils/logUtil.ets | arkts | 日志管理类 | export default class LogUtil {
static TAG: string = "DistScheduleEts"
static info(page:string,log: string) {
console.info(`${LogUtil.TAG}[${page}]:${log}`)
}
static error(page:string,log: string) {
console.error(`${LogUtil.TAG}[${page}]:${log}`)
}
static debug(page:string,log: string) {
conso... | AST#export_declaration#Left export default AST#class_declaration#Left class LogUtil AST#class_body#Left { AST#property_declaration#Left static TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "DistScheduleEts" AST#expression#Right AST#pr... | export default class LogUtil {
static TAG: string = "DistScheduleEts"
static info(page:string,log: string) {
console.info(`${LogUtil.TAG}[${page}]:${log}`)
}
static error(page:string,log: string) {
console.error(`${LogUtil.TAG}[${page}]:${log}`)
}
static debug(page:string,log: string) {
conso... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/utils/logUtil.ets#L19-L33 | 6e971aa05bda1b2960fae269e92b7642e43b656d | gitee | |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/utils/HttpUtil.ets | arkts | 请求配置接口 | export interface RequestConfig {
method?: http.RequestMethod;
headers?: Record<string, string>;
timeout?: number;
data?: Object;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RequestConfig AST#object_type#Left { AST#type_member#Left method ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . RequestMethod AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_... | export interface RequestConfig {
method?: http.RequestMethod;
headers?: Record<string, string>;
timeout?: number;
data?: Object;
} | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L12-L17 | 922df0fd0d9692f28a9ba64b60170ea729629803 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/VideoPlayer/entry/src/main/ets/common/constants/HomeConstants.ets | arkts | Home constants for all features. | export class HomeConstants {
/**
* Constants on the tab page of the main interface.
*/
static readonly CURRENT_INDEX: number = 0;
static readonly TAB_BAR_FIRST: number = 0;
static readonly TAB_BAR_SECOND: number = 1;
static readonly BAR_WIDTH: number = 360;
static readonly BAR_HEIGHT: number = 60;
s... | AST#export_declaration#Left export AST#class_declaration#Left class HomeConstants AST#class_body#Left { /**
* Constants on the tab page of the main interface.
*/ AST#property_declaration#Left static readonly CURRENT_INDEX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_anno... | export class HomeConstants {
static readonly CURRENT_INDEX: number = 0;
static readonly TAB_BAR_FIRST: number = 0;
static readonly TAB_BAR_SECOND: number = 1;
static readonly BAR_WIDTH: number = 360;
static readonly BAR_HEIGHT: number = 60;
static readonly FONT_WEIGHT_SELECT: number = 500;
static reado... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/constants/HomeConstants.ets#L19-L63 | dd1e1aaf0a22ca573fb62073a56cc9b9466c724a | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AvoidTimeComsume/entry/src/main/ets/views/NegativeOfLazyForEach.ets | arkts | count | Simulate time-consuming operations with loop functions | count(): number {
let temp: number = 0;
for (let index = 0; index < 1000000; index++) {
temp += 1;
}
return temp;
} | AST#method_declaration#Left count AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left temp : AST#type_ann... | count(): number {
let temp: number = 0;
for (let index = 0; index < 1000000; index++) {
temp += 1;
}
return temp;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/NegativeOfLazyForEach.ets#L133-L139 | aad95756ea7826833be5e263c97691c6c652a467 | gitee |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/player/XController.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2025/6/9 22:16
@Version V1.0
@Description 播放器控制器 | export class XController extends XComponentController {
private readonly context: Context
private readonly repository: Repository
private appPrefer: AppPrefer = AppStorage.get(AppPrefer.PREFER)!
private surfaceId?: string
private windowWidth = 0
private windowHeight = 0
private avFitMode: 'Inside' ... | AST#export_declaration#Left export AST#ERROR#Left class XController extends AST#type_annotation#Left AST#primary_type#Left XComponentController AST#primary_type#Right AST#type_annotation#Right { AST#property_declaration#Left private readonly context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_t... | export class XController extends XComponentController {
private readonly context: Context
private readonly repository: Repository
private appPrefer: AppPrefer = AppStorage.get(AppPrefer.PREFER)!
private surfaceId?: string
private windowWidth = 0
private windowHeight = 0
private avFitMode: 'Inside' ... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/player/XController.ets#L18-L44 | 734b272fcfb14bf17049d858ede0767328031788 | github | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/common/RdbHelper.ets | arkts | deleteMemo | Delete a memo
@param memoId - ID of memo to delete | async deleteMemo(memoId: number): Promise<void> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_MEMOS);
predicates.equalTo('id', memoId);
try {
await this.rdbStore.delete(predicates);
cons... | AST#method_declaration#Left async deleteMemo AST#parameter_list#Left ( AST#parameter#Left memoId : 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 deleteMemo(memoId: number): Promise<void> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_MEMOS);
predicates.equalTo('id', memoId);
try {
await this.rdbStore.delete(predicates);
cons... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L420-L436 | af67d021044aa0592cec5bac1d1fe82a4a5ee2d4 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets | arkts | drawLine | Draw line.
@param ctx
@param srcX
@param srcY
@param dstX
@param dstY | static drawLine(ctx: CanvasRenderingContext2D, srcX: number, srcY: number, dstX: number, dstY: number) {
ctx.beginPath();
ctx.moveTo(srcX, srcY);
ctx.lineTo(dstX, dstY);
ctx.stroke();
} | AST#method_declaration#Left static drawLine AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left srcX : AST#type_annotation#Left AST#primary_type#Left number AS... | static drawLine(ctx: CanvasRenderingContext2D, srcX: number, srcY: number, dstX: number, dstY: number) {
ctx.beginPath();
ctx.moveTo(srcX, srcY);
ctx.lineTo(dstX, dstY);
ctx.stroke();
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets#L103-L108 | 6c2f42a04071d762603137d8289287f674078ba5 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/MultipleDialog/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Common constants for all features. | export default class CommonConstants {
/**
* The entry ability tag.
*/
static readonly TAG_ABILITY: string = 'EntryAbility';
/**
* The home page tag.
*/
static readonly TAG_HOME: string = 'HomePage';
/**
* The Common utils tag.
*/
static readonly TAG_COMMON_UTILS: string = 'CommonUtils';... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* The entry ability tag.
*/ AST#property_declaration#Left static readonly TAG_ABILITY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST... | export default class CommonConstants {
static readonly TAG_ABILITY: string = 'EntryAbility';
static readonly TAG_HOME: string = 'HomePage';
static readonly TAG_COMMON_UTILS: string = 'CommonUtils';
static readonly TAG_CUSTOM: string = 'CustomDialogWidget';
static readonly FULL_WIDTH: string... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L129 | 2c069782a46c6edf08b85c70ea6d0ab8abf4361f | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets | arkts | encodePKCS1Segment | 加密-分段
@param encodeStr 待加密的字符串
@param pubKey RSA公钥 | static async encodePKCS1Segment(str: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | AST#method_declaration#Left static async encodePKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AS... | static async encodePKCS1Segment(str: string, pubKey: string): Promise<OutDTO<string>> {
return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L60-L62 | 31b5c498a43695c52f799019248319a363d054ed | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 生日提醒配置接口 | export interface BirthdayReminderConfig {
enabled: boolean;
advanceDays: number[];
reminderTime: string; // HH:MM
lunarBirthdayEnabled: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BirthdayReminderConfig 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 advanceDays : AST#... | export interface BirthdayReminderConfig {
enabled: boolean;
advanceDays: number[];
reminderTime: string;
lunarBirthdayEnabled: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L68-L73 | a02e95b90bf3826120da72a59bece854bde77218 | github | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/trainMusic.ets | arkts | musicSwitch | **********************************音乐开关***********************************************// | @Builder
musicSwitch(){
Row(){
Text('训练背景音乐').fontSize(15).fontWeight(600)
Toggle({ type: ToggleType.Switch, isOn: this.isOn })
.onChange((isOn: boolean) => {
this.isOn = isOn
console.log('开关状态:', isOn)
})
.width(50).height(30)
}.width('100%').justifyCon... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right musicSwitch AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
musicSwitch(){
Row(){
Text('训练背景音乐').fontSize(15).fontWeight(600)
Toggle({ type: ToggleType.Switch, isOn: this.isOn })
.onChange((isOn: boolean) => {
this.isOn = isOn
console.log('开关状态:', isOn)
})
.width(50).height(30)
}.width('100%').justifyCon... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/trainMusic.ets#L34-L45 | df54425bee5fd65b2b672da9943dbcea3da2efb7 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/partView/DialogButtonBuilder.ets | arkts | DialogButtonBuilder | 按钮builder | @Builder
export function DialogButtonBuilder(options: ICustomContentOptions) {
if (options?.buttons?.length) {
if (options.buttonOrientation === Orientation.VERTICAL) {
Column() {
buttonBuilder(options.buttons as (CustomButtonOptions | ResourceStr)[])
}
.justifyContent(options.buttonFlex... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DialogButtonBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ICustomContentOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AS... | @Builder
export function DialogButtonBuilder(options: ICustomContentOptions) {
if (options?.buttons?.length) {
if (options.buttonOrientation === Orientation.VERTICAL) {
Column() {
buttonBuilder(options.buttons as (CustomButtonOptions | ResourceStr)[])
}
.justifyContent(options.buttonFlex... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/partView/DialogButtonBuilder.ets#L8-L28 | 3e1d7d96e248cb62fc9e860838ec349c19c550a9 | github |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/utils.ets | arkts | 资源转字符串 | export function ResourceConvertInt(resource:Resource): number{
const rs = parseInt(ctx.resourceManager.getStringSync(resource))
return isNaN(rs) ? 0 : rs
} | AST#export_declaration#Left export AST#function_declaration#Left function ResourceConvertInt AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati... | export function ResourceConvertInt(resource:Resource): number{
const rs = parseInt(ctx.resourceManager.getStringSync(resource))
return isNaN(rs) ? 0 : rs
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/utils.ets#L20-L23 | 67f32ff55c76a7080d6c78b48123cacf3c710649 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Spacer.ets | arkts | SpaceVerticalXLarge | 创建一个特大垂直间距(24vp)
@returns {void} 无返回值 | @Builder
export function SpaceVerticalXLarge(): void {
Blank().height($r("app.float.space_vertical_large_x"));
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalXLarge 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#arkt... | @Builder
export function SpaceVerticalXLarge(): void {
Blank().height($r("app.float.space_vertical_large_x"));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L19-L22 | c09945609c62af0ec033a3099eae4a1bd317b1fd | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | media/ImageShow/imagelibrary/index.ets | arkts | ChoicePhotos | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { ChoicePhotos } from './src/main/ets/components/pages/ChoicePhotos' | AST#export_declaration#Left export { ChoicePhotos } from './src/main/ets/components/pages/ChoicePhotos' AST#export_declaration#Right | export { ChoicePhotos } from './src/main/ets/components/pages/ChoicePhotos' | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/media/ImageShow/imagelibrary/index.ets#L16-L16 | f88f88ee2df9f668827de067ba1ae2a641ddb757 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/StatsManager.ets | arkts | importStats | 导入统计数据 | async importStats(jsonData: string): Promise<boolean> {
try {
const importData = JSON.parse(jsonData);
if (importData.stats) {
this.stats = { ...this.getDefaultStats(), ...importData.stats };
await this.saveStats();
this.notifyListeners('statsImported', this.stats);
retur... | AST#method_declaration#Left async importStats AST#parameter_list#Left ( AST#parameter#Left jsonData : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | async importStats(jsonData: string): Promise<boolean> {
try {
const importData = JSON.parse(jsonData);
if (importData.stats) {
this.stats = { ...this.getDefaultStats(), ...importData.stats };
await this.saveStats();
this.notifyListeners('statsImported', this.stats);
retur... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/StatsManager.ets#L376-L390 | 5234c2ada5fecd2431c1f957edfeb390d0e58520 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets | arkts | rawfile下json文件数据读取工具类 | export class JsonUtils {
/**
* 获取省市区信息的json文件数据
* @param mockFileDir 要传入的json文件。这里指存放在rawfile下的address.json
* @returns 返回json中省信息数组
*/
static getAddressJson(mockFileDir: string): Array<Province> {
const jsonObj: JsonObject = new JsonObject(mockFileDir);
const modelMockData: Array<Province> = jso... | AST#export_declaration#Left export AST#class_declaration#Left class JsonUtils AST#class_body#Left { /**
* 获取省市区信息的json文件数据
* @param mockFileDir 要传入的json文件。这里指存放在rawfile下的address.json
* @returns 返回json中省信息数组
*/ AST#method_declaration#Left static getAddressJson AST#parameter_list#Left ( AST#parameter#Left moc... | export class JsonUtils {
static getAddressJson(mockFileDir: string): Array<Province> {
const jsonObj: JsonObject = new JsonObject(mockFileDir);
const modelMockData: Array<Province> = jsonObj.getAddressData();
return modelMockData;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets#L22-L33 | 222481dcd9842a545578bada78c64a575097cee9 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/LanguageDetector.ets | arkts | detectSystemLanguage | 检测系统语言 | async detectSystemLanguage(): Promise<LanguageDetectionResult> {
try {
// 获取系统语言设置
const systemLanguage = await this.getSystemLanguage();
const systemRegion = await this.getSystemRegion();
// 映射到支持的语言
const mappedLanguage = this.mapSystemLanguage(systemLanguage);
//... | AST#method_declaration#Left async detectSystemLanguage 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 LanguageDetectionResult AST#primary_type#Right AST#type_anno... | async detectSystemLanguage(): Promise<LanguageDetectionResult> {
try {
const systemLanguage = await this.getSystemLanguage();
const systemRegion = await this.getSystemRegion();
const mappedLanguage = this.mapSystemLanguage(systemLanguage);
const confidence ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L218-L252 | d6bd2480c5b461990054efda34b15a3987a14965 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ModelConfigService.ets | arkts | getCustomModels | 获取自定义模型列表 | public getCustomModels(): CustomModelConfig[] {
return this.customModels;
} | AST#method_declaration#Left public getCustomModels AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CustomModelConfig [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#retur... | public getCustomModels(): CustomModelConfig[] {
return this.customModels;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ModelConfigService.ets#L360-L362 | 48e0f4590ca8f3cdb21e2356a6271399de7934fa | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | 日期工具类
提供日期相关的通用工具方法
日期格式化工具类 | export class DateUtils {
/**
* 格式化日期
* @param date 日期对象
* @param format 格式化字符串,支持: YYYY-MM-DD, MM/DD/YYYY, DD/MM/YYYY等
* @returns 格式化后的日期字符串
*/
static formatDate(date: Date, format: string = 'YYYY-MM-DD'): string {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const ... | AST#export_declaration#Left export AST#class_declaration#Left class DateUtils AST#class_body#Left { /**
* 格式化日期
* @param date 日期对象
* @param format 格式化字符串,支持: YYYY-MM-DD, MM/DD/YYYY, DD/MM/YYYY等
* @returns 格式化后的日期字符串
*/ AST#method_declaration#Left static formatDate AST#parameter_list#Left ( AST#parameter#... | export class DateUtils {
static formatDate(date: Date, format: string = 'YYYY-MM-DD'): string {
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L9-L342 | 42deb68b16a47cf9dad736943bee618dccf50070 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 基础提醒设置接口 | export interface BaseReminderSettings {
enabled: boolean;
advanceDays: number[];
frequency: string;
customTime: string;
weekendReminder: boolean;
lunarBirthdayReminder: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BaseReminderSettings 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 advanceDays : AST#ty... | export interface BaseReminderSettings {
enabled: boolean;
advanceDays: number[];
frequency: string;
customTime: string;
weekendReminder: boolean;
lunarBirthdayReminder: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L58-L65 | e64e98cc59db32e6855e8610b726cb3f18089da3 | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/services/MockDataService.ets | arkts | getDocuments | 获取文档列表 | static getDocuments(): Document[] {
return [
{
id: '1',
title: '项目需求文档',
type: 'doc',
size: 1024 * 500,
updateTime: '2025-12-21 10:00:00',
author: '产品经理'
},
{
id: '2',
title: '技术方案设计',
type: 'pdf',
size: 1024 * 1024 * ... | AST#method_declaration#Left static getDocuments AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Document [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#... | static getDocuments(): Document[] {
return [
{
id: '1',
title: '项目需求文档',
type: 'doc',
size: 1024 * 500,
updateTime: '2025-12-21 10:00:00',
author: '产品经理'
},
{
id: '2',
title: '技术方案设计',
type: 'pdf',
size: 1024 * 1024 * ... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/MockDataService.ets#L372-L399 | cbc844addcb732ae5096ad826166287e76124689 | github |
qwerguai/ArkTSComponents.git | 58ac77d9686670d79ba7421d71e68f31870aacd5 | entry/src/main/ets/view/Setting.ets | arkts | Setting | Setting tab content | @Component
export default struct Setting {
@Builder settingCell(item: ItemData) {
Row() {
Row({ space: CommonConstants.COMMON_SPACE }) {
Image(item.img)
.width($r('app.float.setting_size'))
.height($r('app.float.setting_size'))
Text(item.title)
.fontSize($r('a... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Setting AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right settingCell AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#prima... | @Component
export default struct Setting {
@Builder settingCell(item: ItemData) {
Row() {
Row({ space: CommonConstants.COMMON_SPACE }) {
Image(item.img)
.width($r('app.float.setting_size'))
.height($r('app.float.setting_size'))
Text(item.title)
.fontSize($r('a... | https://github.com/qwerguai/ArkTSComponents.git/blob/58ac77d9686670d79ba7421d71e68f31870aacd5/entry/src/main/ets/view/Setting.ets#L25-L128 | 9facd577b54d380f4a6e799109743d5313e875b1 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PickerUtil.ets | arkts | savePhoto | 通过保存模式拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入。(该方法系统已废弃,推荐使用PhotoHelper工具类)
@param newFileNames 拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入。
@returns 返回相册uris | static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> {
const photoPicker = new picker.PhotoViewPicker(getContext());
const PhotoSaveOptions = new picker.PhotoSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
PhotoSaveOptions.newFileNames = newFileNames... | AST#method_declaration#Left static async savePhoto AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : 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 > A... | static async savePhoto(newFileNames?: Array<string>): Promise<Array<string>> {
const photoPicker = new picker.PhotoViewPicker(getContext());
const PhotoSaveOptions = new picker.PhotoSaveOptions();
if (newFileNames !== undefined && newFileNames.length > 0) {
PhotoSaveOptions.newFileNames = newFileNames... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L82-L89 | e4423654b96d2d4032df50d8643c028c29a80118 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/constants/AppConstants.ets | arkts | 日期格式常量 | export class DateFormatConstants {
// 日期格式
static readonly DATE_FORMAT_YYYY_MM_DD = 'YYYY-MM-DD';
static readonly DATE_FORMAT_MM_DD = 'MM-DD';
static readonly DATE_FORMAT_YYYY_MM_DD_CN = 'YYYY年MM月DD日';
static readonly DATE_FORMAT_MM_DD_CN = 'MM月DD日';
static readonly DATE_FORMAT_MM_DD_YYYY = 'MM/DD/YYYY';
... | AST#export_declaration#Left export AST#class_declaration#Left class DateFormatConstants AST#class_body#Left { // 日期格式 AST#property_declaration#Left static readonly DATE_FORMAT_YYYY_MM_DD = AST#expression#Left 'YYYY-MM-DD' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonl... | export class DateFormatConstants {
static readonly DATE_FORMAT_YYYY_MM_DD = 'YYYY-MM-DD';
static readonly DATE_FORMAT_MM_DD = 'MM-DD';
static readonly DATE_FORMAT_YYYY_MM_DD_CN = 'YYYY年MM月DD日';
static readonly DATE_FORMAT_MM_DD_CN = 'MM月DD日';
static readonly DATE_FORMAT_MM_DD_YYYY = 'MM/DD/YYYY';
static ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/constants/AppConstants.ets#L265-L285 | d0512d099da1cb5ffefb532cd336b146a52a12ac | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.utils.d.ets | arkts | query | Query information about the specified lock.
@param { string } name - name of the lock.
@returns { AsyncLockState } Returns an instance of AsyncLockState.
@throws { BusinessError } 401 - The input parameters are invalid.
@throws { BusinessError } 10200030 - The lock does not exist.
@static
@syscap SystemCapability.Util... | static query(name: string): AsyncLockState; | AST#method_declaration#Left static query AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AsyncLockState AST#primary_t... | static query(name: string): AsyncLockState; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L153-L153 | 5275068c4a3a364152de087530fdc179d974d2cc | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets | arkts | getSubdirectory | 根据沙箱路径打开目录 | getSubdirectory(filePath: string): Array<SubDirectoryType> {
// 获取目录
let dir = fileio.opendirSync(filePath);
// 读取的结果
let dirent: fileio.Dirent;
// 结果数组
class SubDirectory {
name: string = ''
type: number = 0
time: Date
childrenNum: number = 0
fileSize: string = ''
... | AST#method_declaration#Left getSubdirectory AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left... | getSubdirectory(filePath: string): Array<SubDirectoryType> {
let dir = fileio.opendirSync(filePath);
let dirent: fileio.Dirent;
class SubDirectory {
name: string = ''
type: number = 0
time: Date
childrenNum: number = 0
fileSize: string = ''
constructor(time... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets#L49-L63 | c68f1de21056936066c35444169e5249cb356928 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/components/StockCodeView.d.ets | arkts | StockCodeView | @keepTs @ts-nocheck
AUTHOR:AbnerMing
DATE:2024/10/24
INTRODUCE:股票代码键盘 | @Component
export declare struct StockCodeView {
private mCodeList;
bgColor: ResourceColor;
codeBgColor: ResourceColor;
numberColor: ResourceColor;
notNumberColor: ResourceColor;
rootHeight: number;
rectHeight: Length;
rowsGap: Length;
columnsGap: Length;
gridMarginTop: Length;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct StockCodeView AST#component_body#Left { AST#property_declaration#Left private mCodeList ; AST#property_declaration#Right AST#property_declaration#Left bgColor : AST#type_annotati... | @Component
export declare struct StockCodeView {
private mCodeList;
bgColor: ResourceColor;
codeBgColor: ResourceColor;
numberColor: ResourceColor;
notNumberColor: ResourceColor;
rootHeight: number;
rectHeight: Length;
rowsGap: Length;
columnsGap: Length;
gridMarginTop: Length;
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@abner+keyboard@1.0.2/oh_modules/@abner/keyboard/src/main/ets/components/StockCodeView.d.ets#L8-L36 | 8a250ea8b5c9ee954ff397c72ab537c2df62bac1 | github |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/common/utils/WriteFile.ets | arkts | writeFile.
Write content to a file
@param content Contents to be written to the file | export function writeFile(content: string,filename: string): void {
try {
let filePath=''
if(filename!=''){
filePath = filesDir + '/'+filename;
}else{
filePath= filesDir + '/test';
}
// Open a file stream based on the file path.
let fileStream = fileIo.createStreamSync(filePath, "... | AST#export_declaration#Left export AST#function_declaration#Left function writeFile AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filename : AST#type_annotation#Left A... | export function writeFile(content: string,filename: string): void {
try {
let filePath=''
if(filename!=''){
filePath = filesDir + '/'+filename;
}else{
filePath= filesDir + '/test';
}
let fileStream = fileIo.createStreamSync(filePath, "w+");
fileStream.writeSync(content);
... | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/WriteFile.ets#L30-L46 | bb8cfa78bbbb5c298eb8f4b152dae3dfdd695a3d | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets | arkts | getDataPreferences | Get data preferences action. | getDataPreferences(common: Object): Promise<preferences.Preferences> {
return preferences.getPreferences(getContext(common), CommonConstants.PREFERENCES_FILE_NAME);
} | AST#method_declaration#Left getDataPreferences AST#parameter_list#Left ( AST#parameter#Left common : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef... | getDataPreferences(common: Object): Promise<preferences.Preferences> {
return preferences.getPreferences(getContext(common), CommonConstants.PREFERENCES_FILE_NAME);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets#L122-L124 | 91ea69e84a08f861399b31a80de0a87581ed2b31 | gitee |
sea5241/PictureSelector | 09bac407ebd61100d1ccbf6e6d3b6349cb0013d7 | selector/src/main/ets/dialog/CommonDialog.ets | arkts | CommonDialog | 自定义弹窗
@Author sea
@Date 2024/7/8 | @CustomDialog
export struct CommonDialog {
// 弹窗数据
@Prop commonDialogData: CommonDialogData
// 弹窗控制器
controller?: CustomDialogController
// 取消点击事件
cancel: () => void = () => {
}
// 确认点击事件
confirm: () => void = () => {
}
build() {
Column() {
Text(this.commonDialogData.title)
.fon... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommonDialog AST#component_body#Left { // 弹窗数据 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right commonDialogData AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left CommonDial... | @CustomDialog
export struct CommonDialog {
@Prop commonDialogData: CommonDialogData
controller?: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text(this.commonDialogData.title)
.fontSize(17)
.width(SIZE_MAT... | https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/dialog/CommonDialog.ets#L8-L72 | ff1bd04d2f996122d18d066dd503168adca5a101 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets | arkts | showSuccess | / 成功弹框 | public static showSuccess(loadingText: ResourceStr) {
JhProgressHUD._showToast(loadingText, _ToastType.success)
} | AST#method_declaration#Left public static showSuccess AST#parameter_list#Left ( AST#parameter#Left loadingText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stat... | public static showSuccess(loadingText: ResourceStr) {
JhProgressHUD._showToast(loadingText, _ToastType.success)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L54-L56 | be826f57dc1a1bdc5123b782f3e2d094ae631440 | github |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/utils/PreferenceModel.ets | arkts | getPreferencesFromStorage | 初始化 Preferences 首选项 | async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, 'mystore');
} catch (err) {
console.error("Failed to get preferences:", err);
preference = null; // 确保在出错时重置为 null
}
} | AST#method_declaration#Left async getPreferencesFromStorage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left prefere... | async getPreferencesFromStorage() {
try {
preference = await dataPreferences.getPreferences(context, 'mystore');
} catch (err) {
console.error("Failed to get preferences:", err);
preference = null;
}
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L15-L22 | def3b8320611e6b78861bc34c0d18cfc3d17bd4c | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/DemoCounterState.ets | arkts | reset | 重置计数
@param {number} resetValue - 重置值,默认 0
@returns {void} 无返回值
@example
getDemoCounterState().reset(); // 归零 | reset(resetValue: number = 0): void {
this.count = resetValue;
} | AST#method_declaration#Left reset AST#parameter_list#Left ( AST#parameter#Left resetValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pr... | reset(resetValue: number = 0): void {
this.count = resetValue;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/DemoCounterState.ets#L57-L59 | ac935513547a26f86395b5675535fbc95141b27e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/PreferencesService.ets | arkts | initialize | 初始化首选项存储
@param context 应用上下文 | async initialize(context: common.UIAbilityContext): Promise<void> {
try {
if (this.initialized) {
return;
}
this.dataPreferences = await preferences.getPreferences(context, StorageConstants.PREFERENCES_NAME);
this.initialized = true;
hilog.info(0x0001, 'BirthdayReminder... | AST#method_declaration#Left async initialize AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | async initialize(context: common.UIAbilityContext): Promise<void> {
try {
if (this.initialized) {
return;
}
this.dataPreferences = await preferences.getPreferences(context, StorageConstants.PREFERENCES_NAME);
this.initialized = true;
hilog.info(0x0001, 'BirthdayReminder... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L33-L48 | e65ce4c05000de84946d5cc7e1a5fbfb6f9712e2 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/SimpleAIService.ets | arkts | initializeDefaultConfig | 初始化默认配置(已禁用 - 需要用户手动配置) | private initializeDefaultConfig(): void {
// 不再自动配置默认模型,要求用户手动配置
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Default config initialization disabled - user must configure manually');
} | AST#method_declaration#Left private initializeDefaultConfig 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#Lef... | private initializeDefaultConfig(): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Default config initialization disabled - user must configure manually');
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L81-L84 | 5660445dc22240ccd52501e0173c6e3e74cb23b1 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ColorTemplate.ets | arkts | colorWithAlpha | Sets the alpha component of the given color.
@param color
@param alpha 0 - 255
@return | public static colorWithAlpha(color: number, alpha: number): number {
return (color & 0xffffff) | ((alpha & 0xff) << 24);
} | AST#method_declaration#Left public static colorWithAlpha AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#... | public static colorWithAlpha(color: number, alpha: number): number {
return (color & 0xffffff) | ((alpha & 0xff) << 24);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L203-L205 | 1fee39e869161cea7db0d515b02991f77537cd2d | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets | arkts | start | 播放 | static async start() {
// 当且仅当状态为prepared、paused和stopped之一时才能启动渲染
await AudioRendererManager.audioRender?.start();
} | AST#method_declaration#Left static async start AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 当且仅当状态为prepared、paused和stopped之一时才能启动渲染 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AS... | static async start() {
await AudioRendererManager.audioRender?.start();
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets#L71-L74 | 6ed052159ca7a0a9c2f7af0cd477bc2ba3b41c7f | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/PaletteComponent.ets | arkts | 画板事件监听 | export interface PaletteEventListener {
onAdd: (data: PaletteData) => void;
onReady: (controller: PaletteController) => void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PaletteEventListener AST#object_type#Left { AST#type_member#Left onAdd : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left PaletteData AST#primary_... | export interface PaletteEventListener {
onAdd: (data: PaletteData) => void;
onReady: (controller: PaletteController) => void;
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/PaletteComponent.ets#L35-L38 | a6b889466ffeff787c274df74361fc57e74b94e4 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/WaterFlowDataSource.ets | arkts | getData | 获取索引对应的数据
@param index 数组索引
@returns | public getData(index: number): ProductInfo {
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 ProductInfo AST#primary_t... | public getData(index: number): ProductInfo {
return this.dataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/WaterFlowDataSource.ets#L36-L38 | f9f59a53f129ed95a1b496c953d36d6ca242a306 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets | arkts | getAesGenerateProperties | 生成AES密钥属性信息 | function getAesGenerateProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
... | AST#function_declaration#Left function getAesGenerateProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#R... | function getAesGenerateProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_AES
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L196-L212 | 43b6f5ec10a104c9fa2b5faba2d422f8cc3f72c1 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List_HDC/entry/src/main/ets/common/utils/BroadCast.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export class BroadCast {
private callBackArray: Array<Array<() => void>> = [];
public on(event: BroadCastType, callback: () => void) {
(this.callBackArray[event] || (this.callBackArray[event] = [])).push(callback);
}
public off(event: BroadCastType | null, callback: () => void) {
if (event === null) {... | AST#export_declaration#Left export AST#class_declaration#Left class BroadCast AST#class_body#Left { AST#property_declaration#Left private callBackArray : 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 AST#generic_type#L... | export class BroadCast {
private callBackArray: Array<Array<() => void>> = [];
public on(event: BroadCastType, callback: () => void) {
(this.callBackArray[event] || (this.callBackArray[event] = [])).push(callback);
}
public off(event: BroadCastType | null, callback: () => void) {
if (event === null) {... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/utils/BroadCast.ets#L16-L62 | ed23b143b38020b204cfe2fdadbaf1261ce66725 | gitee | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/io/FsFile.ets | arkts | readJson | Function to read JSON data from a file.
@param file The file to read JSON data from.
@returns The parsed JSON data. | function readJson<T>(file: FsFile): T {
const text: string = fs.readFileSync(file, 'utf-8');
return JSON.parse(text) as T;
} | AST#function_declaration#Left function readJson AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left FsFile AST#primary_type#Right AST#type_annotation#Right AST#paramet... | function readJson<T>(file: FsFile): T {
const text: string = fs.readFileSync(file, 'utf-8');
return JSON.parse(text) as T;
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/io/FsFile.ets#L43-L46 | bbd1c10bfe532dee971090e0e514176e0904b55b | github |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/utils/AnimationUtils.ets | arkts | 动画工具类 | export class AnimationUtils {
/**
* 创建弹簧曲线动画
* @param stiffness - 刚度
* @param damping - 阻尼
* @param mass - 质量
* @returns 弹簧曲线
*/
static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = Animat... | AST#export_declaration#Left export AST#class_declaration#Left class AnimationUtils AST#class_body#Left { /**
* 创建弹簧曲线动画
* @param stiffness - 刚度
* @param damping - 阻尼
* @param mass - 质量
* @returns 弹簧曲线
*/ AST#method_declaration#Left static createSpringCurve AST#parameter_list#Left ( AST#parameter#Left ... | export class AnimationUtils {
static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = AnimationConstants.SPRING_MASS
): ICurve {
return curves.springCurve(stiffness, damping, mass, 0);
}
static ... | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/AnimationUtils.ets#L18-L69 | b63e95570aaabad8ee9002fb346686a4a96f780d | github | |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/common/utils/FileManager.ets | arkts | 新增 filesDir 属性 | constructor(context: Context) {
this.context = context;
// 从 context 中提取 filesDir
this.filesDir = this.getFilesDir();
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statemen... | constructor(context: Context) {
this.context = context;
this.filesDir = this.getFilesDir();
} | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/FileManager.ets#L31-L35 | 18e2a63b19831b730721d55b764d49384143e272 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | generateWelcomeText | 生成欢迎文本 | private generateWelcomeText(profile: UserProfile): string {
const greetings = [
`你好${profile.name}!我是你的生日助手,有什么可以帮你的吗?`,
`嗨!我可以帮你管理生日提醒,需要我做什么呢?`,
`欢迎回来!让我为你查看一下最新的生日信息吧~`,
`你好!我是AI生日管家,随时为你服务!`
];
return greetings[Math.floor(Math.random() * greetings.length)];
} | AST#method_declaration#Left private generateWelcomeText AST#parameter_list#Left ( AST#parameter#Left profile : AST#type_annotation#Left AST#primary_type#Left UserProfile AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left strin... | private generateWelcomeText(profile: UserProfile): string {
const greetings = [
`你好${profile.name}!我是你的生日助手,有什么可以帮你的吗?`,
`嗨!我可以帮你管理生日提醒,需要我做什么呢?`,
`欢迎回来!让我为你查看一下最新的生日信息吧~`,
`你好!我是AI生日管家,随时为你服务!`
];
return greetings[Math.floor(Math.random() * greetings.length)];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L579-L588 | a26b3589a0a99f226c78d5c5a298038bcd70b75c | github |
GikkiAres/todolist.git | 3a7571832fd2985ffc1a4eb4673b370ef715fe8e | entry/src/main/ets/pages/ToDoListPage.ets | arkts | SwipeMenu | 左滑菜单
@param $$
@param index | @Builder
SwipeMenu(todo: TodoModel, index: number) {
Column() {
Row() {
// Finish
if(todo.state == TodoState.Todo) {
Button({ type: ButtonType.Normal }) {
Image($r("app.media.svg_start"))
.width(30)
.height(30)
.fillColor(Color.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SwipeMenu AST#parameter_list#Left ( AST#parameter#Left todo : AST#type_annotation#Left AST#primary_type#Left TodoModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left A... | @Builder
SwipeMenu(todo: TodoModel, index: number) {
Column() {
Row() {
if(todo.state == TodoState.Todo) {
Button({ type: ButtonType.Normal }) {
Image($r("app.media.svg_start"))
.width(30)
.height(30)
.fillColor(Color.White)
... | https://github.com/GikkiAres/todolist.git/blob/3a7571832fd2985ffc1a4eb4673b370ef715fe8e/entry/src/main/ets/pages/ToDoListPage.ets#L41-L94 | 924703bba33b40e5e2da72f1f4b811e70caa0ca6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | generateCalendarDays | 生成日历天数 | private generateCalendarDays(date: Date, contacts: Contact[]): CalendarDay[] {
const year = date.getFullYear();
const month = date.getMonth();
const today = new Date();
const todayString = DateUtils.formatDate(today);
// 获取月份第一天和最后一天
const firstDay = new Date(year, month, 1);
const lastDay ... | AST#method_declaration#Left private generateCalendarDays AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_t... | private generateCalendarDays(date: Date, contacts: Contact[]): CalendarDay[] {
const year = date.getFullYear();
const month = date.getMonth();
const today = new Date();
const todayString = DateUtils.formatDate(today);
const firstDay = new Date(year, month, 1);
const lastDay = new Date(year... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L94-L141 | 2fba6e9adde7f094c948d521b82077b5cc3daf44 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/NotificationUtil.ets | arkts | publishBasic | 推送普通文本通知
@param options 通知实体
@returns | static async publishBasic(options: NoticeOptions): Promise<void> {
if (!options) {
options = new NoticeOptions();
}
if (!options.id) {
options.id = RandomUtil.randomNumber(10000, 100000);
}
if (options.isOngoing == undefined) {
options.isOngoing = true;
}
if (options.isStop... | AST#method_declaration#Left static async publishBasic AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NoticeOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#g... | static async publishBasic(options: NoticeOptions): Promise<void> {
if (!options) {
options = new NoticeOptions();
}
if (!options.id) {
options.id = RandomUtil.randomNumber(10000, 100000);
}
if (options.isOngoing == undefined) {
options.isOngoing = true;
}
if (options.isStop... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L92-L147 | 9dbd9f3462924f38abb09d84d276c6696f04b54d | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/dialog/TipsDialog.ets | arkts | 【系统】Tips 吐司弹框
@description 该弹窗采用系统Tips弹窗view,所以样式和内容构建参照系统参数设置。(ITipsDialogOptions 即 TipsDialog 的参数) | export class TipsDialog extends BaseModalDialog implements IDialog {
protected getBuilder(): WrappedBuilder<[IBaseDialogOptions]> {
return wrapBuilder(TipsDialogBuilder) as WrappedBuilder<[IBaseDialogOptions]>
}
protected initModalOptions(options: ITipsDialogOptions): IBaseDialogOptions {
return this.ini... | AST#export_declaration#Left export AST#class_declaration#Left class TipsDialog extends AST#type_annotation#Left AST#primary_type#Left BaseModalDialog AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements IDialog AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Le... | export class TipsDialog extends BaseModalDialog implements IDialog {
protected getBuilder(): WrappedBuilder<[IBaseDialogOptions]> {
return wrapBuilder(TipsDialogBuilder) as WrappedBuilder<[IBaseDialogOptions]>
}
protected initModalOptions(options: ITipsDialogOptions): IBaseDialogOptions {
return this.ini... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/TipsDialog.ets#L12-L32 | 771da07be130ea2d23ffb32184d571f8eb8fd1fa | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | isPausing | 检查是否暂停 | isPausing(): boolean {
return this.paused;
} | AST#method_declaration#Left isPausing AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Le... | isPausing(): boolean {
return this.paused;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L123-L125 | 40cdbec371d05455be4a7a584acdc1e0a94a4665 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.