nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineDataSet.ets | arkts | setCircleHoleRadius | Sets the hole radius of the drawn circles.
Default radius = 2f, Min = 0.5f
@param holeRadius | public setCircleHoleRadius(holeRadius: number): void {
if (holeRadius >= 0.5) {
// this.mCircleHoleRadius = Utils.convertDpToPixel(holeRadius);
this.mCircleHoleRadius = holeRadius;
} else {
LogUtil.log("LineDataSet", "Circle radius cannot be < 0.5")
}
} | AST#method_declaration#Left public setCircleHoleRadius AST#parameter_list#Left ( AST#parameter#Left holeRadius : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST... | public setCircleHoleRadius(holeRadius: number): void {
if (holeRadius >= 0.5) {
this.mCircleHoleRadius = holeRadius;
} else {
LogUtil.log("LineDataSet", "Circle radius cannot be < 0.5")
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineDataSet.ets#L175-L183 | 4ca813643bf9cf55940ccd82929a40a1a54ebf6a | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/QuestionnaireBuilder.ets | arkts | openSurveyView | 跳转到web组件页面 | private openSurveyView() {
let param: object = new Object()
param['questionnaireUrl'] = this.questionnaireUrl
param['webinar_info'] = this.webinar
param['questionnaireList'] = this.questionnaireList
const pathInfo = new NavPathInfo(
'QuestionnairePage', // 页面名称
param, // 传递给子页面的参数
... | AST#method_declaration#Left private openSurveyView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left param : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Ri... | private openSurveyView() {
let param: object = new Object()
param['questionnaireUrl'] = this.questionnaireUrl
param['webinar_info'] = this.webinar
param['questionnaireList'] = this.questionnaireList
const pathInfo = new NavPathInfo(
'QuestionnairePage',
param,
undefined,
tr... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/QuestionnaireBuilder.ets#L112-L132 | 6f39f75dd16f06dbfec61ebec97deec9fa9059b2 | gitee |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/Index.ets | arkts | handleLogin | 处理登录 | async handleLogin() {
// 验证账号
if (!this.account) {
promptAction.showToast({
message: '请输入账号',
duration: 2000
});
return;
}
// 密码登录验证
if (this.isPasswordLogin) {
if (!this.password) {
promptAction.showToast({
message: '请输入密码',
d... | AST#method_declaration#Left async handleLogin AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 验证账号 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right... | async handleLogin() {
if (!this.account) {
promptAction.showToast({
message: '请输入账号',
duration: 2000
});
return;
}
if (this.isPasswordLogin) {
if (!this.password) {
promptAction.showToast({
message: '请输入密码',
duration: 2000
... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Index.ets#L230-L343 | 5e85a6faf99df9d56792b5d5f1931d497f12630d | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets | arkts | Initialization requires UIContext to be obtained in Ability. | export const createNWeb = (url: string, uiContext: UIContext) => {
// Create NodeController
let baseNode: MyNodeController = new MyNodeController();
let controller: WebviewController = new webview.WebviewController() ;
// Initialize a custom web component
baseNode.initWeb(url, uiContext, controller);
contro... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left createNWeb = AST#expression#Left AST#arrow_function#Left 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#param... | export const createNWeb = (url: string, uiContext: UIContext) => {
let baseNode: MyNodeController = new MyNodeController();
let controller: WebviewController = new webview.WebviewController() ;
baseNode.initWeb(url, uiContext, controller);
controllerMap.set(url, controller)
NodeMap.set(url, baseNode);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets#L103-L113 | b95986dff9108abc1468e72f5080a5a0833f4935 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/GridItemDrag.ets | arkts | pixelMapBuilder | 自定义拖拽过程中显示的内容 | @Builder
pixelMapBuilder(item: string) {
Text(item)
.fontSize(16)
.width(80)
.height(60)
.backgroundColor(0xF9CF93)
.textAlign(TextAlign.Center)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right pixelMapBuilder AST#parameter_list#Left ( AST#parameter#Left item : 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... | @Builder
pixelMapBuilder(item: string) {
Text(item)
.fontSize(16)
.width(80)
.height(60)
.backgroundColor(0xF9CF93)
.textAlign(TextAlign.Center)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/GridItemDrag.ets#L24-L32 | 5ae2179890cea29e126aaea9e0da799f857d805b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets | arkts | setAVMetadata | Setting the Display Data of the Playback Control Center.
@param context Context. | public static setAVMetadata(playBarModel: PlayBarModel) {
let metadata = {
assetId: playBarModel!.musicItem!.id.toString(),
title: playBarModel!.musicItem!.name,
artist: playBarModel!.musicItem!.singer
} as avSession.AVMetadata;
let currentSession = GlobalContext.getContext().getObject('cu... | AST#method_declaration#Left public static setAVMetadata AST#parameter_list#Left ( AST#parameter#Left playBarModel : AST#type_annotation#Left AST#primary_type#Left PlayBarModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AS... | public static setAVMetadata(playBarModel: PlayBarModel) {
let metadata = {
assetId: playBarModel!.musicItem!.id.toString(),
title: playBarModel!.musicItem!.name,
artist: playBarModel!.musicItem!.singer
} as avSession.AVMetadata;
let currentSession = GlobalContext.getContext().getObject('cu... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/AvSessionUtil.ets#L97-L105 | 19e4587423681a4bb776ed274db67875e041cb7f | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_platform/ace_ets_module_platform_api11/entry/src/main/ets/MainAbility/pages/XComponent/Log.ets | arkts | showDebug | print debug level log
@param {string} tag - Page or class tag
@param {string} log - Log needs to be printed | static showDebug(tag: string, log: undefined|null|string|number) {
console.debug(`${TAG} tag: ${tag} --> ${log}`);
} | AST#method_declaration#Left static showDebug AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left undefin... | static showDebug(tag: string, log: undefined|null|string|number) {
console.debug(`${TAG} tag: ${tag} --> ${log}`);
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_platform/ace_ets_module_platform_api11/entry/src/main/ets/MainAbility/pages/XComponent/Log.ets#L38-L40 | f61a3d6f2bcbf8b1799535bde5da971397936aa6 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowWebView.ets | arkts | on_use_adblock_state_change | Enable ads block for all tabs. | on_use_adblock_state_change() {
console.log('[meowWebView] enableAdsBlock: ' + (this.use_adblock ? 'true' : 'false'))
try {
for (let index = 0; index < this.bunch_of_tabs.Tabs.length; index++) {
this.bunch_of_tabs.Tabs[index].controller!.enableAdsBlock(this.use_adblock);
}
} catch (e) {
... | AST#method_declaration#Left on_use_adblock_state_change 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#... | on_use_adblock_state_change() {
console.log('[meowWebView] enableAdsBlock: ' + (this.use_adblock ? 'true' : 'false'))
try {
for (let index = 0; index < this.bunch_of_tabs.Tabs.length; index++) {
this.bunch_of_tabs.Tabs[index].controller!.enableAdsBlock(this.use_adblock);
}
} catch (e) {
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowWebView.ets#L614-L623 | 1fc3f7c5b3bef72dd2af37166ae86b63b19b6788 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets | arkts | updateFileData | 刷新当前页面数据 | updateFileData() {
Logger.info(TAG, "updateFileData directoryPath2: " + this.directoryPath + ", directoryName: " + this.directoryName);
this.subTitle = updateContextArea(this.directoryPath, myContext);
this.fileData = [];
try {
let subdirectory = FileSystem.getSubdirectory(this.directoryPath);
... | AST#method_declaration#Left updateFileData 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 Logger AST#expression#Right . info A... | updateFileData() {
Logger.info(TAG, "updateFileData directoryPath2: " + this.directoryPath + ", directoryName: " + this.directoryName);
this.subTitle = updateContextArea(this.directoryPath, myContext);
this.fileData = [];
try {
let subdirectory = FileSystem.getSubdirectory(this.directoryPath);
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets#L162-L176 | 0ec9237195cf5daf8bd0a8f55edf932b3ae350c4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/nativeprogressnotify/Index.ets | arkts | NativeProgressNotifyComponent | 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 { NativeProgressNotifyComponent } from './src/main/ets/view/NativeProgressNotify'; | AST#export_declaration#Left export { NativeProgressNotifyComponent } from './src/main/ets/view/NativeProgressNotify' ; AST#export_declaration#Right | export { NativeProgressNotifyComponent } from './src/main/ets/view/NativeProgressNotify'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeprogressnotify/Index.ets#L16-L16 | 53493ee0720ffe1a9a9cdce922c704cf140e86d4 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ColorTemplate.ets | arkts | createColors | turn an array of resource-colors (contains resource-id integers) into an
array list of actual color integers
@param r
@param colors an integer array of resource id's of colors
@return | public static createColors(colors?: number[]): JArrayList<number> {
let result: JArrayList<number> = new JArrayList<number>();
if (colors) {
for (let i = 0; i < colors.length; i++) {
result.add(colors[i]);
}
}
return result;
} | AST#method_declaration#Left public static createColors AST#parameter_list#Left ( AST#parameter#Left colors ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann... | public static createColors(colors?: number[]): JArrayList<number> {
let result: JArrayList<number> = new JArrayList<number>();
if (colors) {
for (let i = 0; i < colors.length; i++) {
result.add(colors[i]);
}
}
return result;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ColorTemplate.ets#L215-L223 | 4a0127b3defdc3d4d1ccf0d5551f78ce3daf1f9f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/settings/ThemeCustomizationPage.ets | arkts | buildCustomColorDialog | 构建自定义颜色对话框 | @Builder
buildCustomColorDialog() {
Column({ space: UIConstants.LARGE_PADDING }) {
Text('自定义颜色')
.fontSize(UIConstants.FONT_SIZE_HEADING)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.text_primary'))
Column({ space: UIConstants.DEFAULT_PADDING }) {
// 主色
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCustomColorDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compon... | @Builder
buildCustomColorDialog() {
Column({ space: UIConstants.LARGE_PADDING }) {
Text('自定义颜色')
.fontSize(UIConstants.FONT_SIZE_HEADING)
.fontWeight(FontWeight.Medium)
.fontColor($r('app.color.text_primary'))
Column({ space: UIConstants.DEFAULT_PADDING }) {
R... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L724-L833 | 52ea42865e56f2f98b3beeff1544f5ca7989a37c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/GoodsRepository.ets | arkts | getGoodsTypeList | 查询商品分类列表
@returns 商品分类列表 | async getGoodsTypeList(): Promise<NetworkResponse<Category[]>> {
return this.networkDataSource.getGoodsTypeList();
} | AST#method_declaration#Left async getGoodsTypeList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < ... | async getGoodsTypeList(): Promise<NetworkResponse<Category[]>> {
return this.networkDataSource.getGoodsTypeList();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/GoodsRepository.ets#L38-L40 | 9bd116af058e4336ea7bcf4bd50122bb74ca4920 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | wordIdsWhenNew | MARK: - Functions for wordIds in this plan / 获取某天的新字wordIds | wordIdsWhenNew(dayOf: DayOf): number[] {
return this.wordIdsFor(dayOf, [BoxType.New]);
} | AST#method_declaration#Left wordIdsWhenNew AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf 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_type#Left number... | wordIdsWhenNew(dayOf: DayOf): number[] {
return this.wordIdsFor(dayOf, [BoxType.New]);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L250-L252 | b62401a6fbd48d59c62d39d452a278570ecd1d36 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelDelete.ets | arkts | Emitted whenever a channel is deleted.
@event Client#channelDelete
@param {Channel} channel The channel that was deleted | export default ChannelDeleteHandler; | AST#export_declaration#Left export default AST#expression#Left ChannelDeleteHandler AST#expression#Right ; AST#export_declaration#Right | export default ChannelDeleteHandler; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelDelete.ets#L34-L34 | 34f91094dc8c8320dc1ab7b713f391f12037c566 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/BindSheet/entry/src/main/ets/pages/bindSheet/template9/Index.ets | arkts | mySheet | 通过@Builder构建半模态展示界面 | @Builder
mySheet() {
Column() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap }) {
ForEach(this.menuList, (item: string) => {
Text(item)
.fontSize(16)
.fontColor(0x333333)
.backgroundColor(0xf1f1f1)
.borderRadius(8)
.ma... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right mySheet AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#... | @Builder
mySheet() {
Column() {
Flex({ direction: FlexDirection.Row, wrap: FlexWrap.Wrap }) {
ForEach(this.menuList, (item: string) => {
Text(item)
.fontSize(16)
.fontColor(0x333333)
.backgroundColor(0xf1f1f1)
.borderRadius(8)
.ma... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/BindSheet/entry/src/main/ets/pages/bindSheet/template9/Index.ets#L23-L42 | 54d665a8974d01c1500a97e12fc32ec698dae522 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | resetToDefaultTheme | 重置为默认主题 | private resetToDefaultTheme(): void {
this.selectedThemeColor = '#4ECDC4';
this.isDarkModeEnabled = false;
this.selectedFontSize = 16;
promptAction.showToast({
message: '已重置为默认主题',
duration: 2000
});
} | AST#method_declaration#Left private resetToDefaultTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression... | private resetToDefaultTheme(): void {
this.selectedThemeColor = '#4ECDC4';
this.isDarkModeEnabled = false;
this.selectedFontSize = 16;
promptAction.showToast({
message: '已重置为默认主题',
duration: 2000
});
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5827-L5835 | 741c27aafeaaf71c40d0274fcd9e683caefb679a | github |
ark-ui/MiniCanvas | 2a9a12127ed5ea5b6b87da252d258c8ad5700f56 | mini_canvas/src/main/ets/components/canvas/attribte.ets | arkts | default | 默认画布属性 | static default(): MiniCanvasAttribute {
return MiniCanvasAttribute.checkAttribute(new MiniCanvasAttribute())
} | AST#method_declaration#Left static default AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MiniCanvasAttribute AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#cal... | static default(): MiniCanvasAttribute {
return MiniCanvasAttribute.checkAttribute(new MiniCanvasAttribute())
} | https://github.com/ark-ui/MiniCanvas/blob/2a9a12127ed5ea5b6b87da252d258c8ad5700f56/mini_canvas/src/main/ets/components/canvas/attribte.ets#L66-L68 | 14eccda6ca91e5dd904ad5f5cf1a5b2e211ad6b9 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | getDataHtml | 读取系统剪贴板HTML内容,使用Promise异步回调。
@returns | static async getDataHtml(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryHtml();
} | AST#method_declaration#Left static async getDataHtml AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#... | static async getDataHtml(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryHtml();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L165-L168 | dbff517a3274e256a61d6a00ec485572cc474213 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets | arkts | formatDateTimeString | 设置标准格式的日期和时间显示字符串 | formatDateTimeString(dateTimeString: string | null): string {
if (!dateTimeString) return '未设置';
try {
const dateObj = new Date(dateTimeString);
const year = dateObj.getFullYear();
const month = (dateObj.getMonth() + 1).toString().padStart(2, '0');
const day = dateObj.getDate().toSt... | AST#method_declaration#Left formatDateTimeString AST#parameter_list#Left ( AST#parameter#Left dateTimeString : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter... | formatDateTimeString(dateTimeString: string | null): string {
if (!dateTimeString) return '未设置';
try {
const dateObj = new Date(dateTimeString);
const year = dateObj.getFullYear();
const month = (dateObj.getMonth() + 1).toString().padStart(2, '0');
const day = dateObj.getDate().toSt... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L476-L491 | 77704e3e7c659cb98fb1cab79056d2712d7c2752 | github |
gentslava/Home-Assistant-HarmonyOS-Next.git | d8cf624f6d92bedac06380b01a77c3c51e55beb5 | entry/src/main/ets/data/repository/MockHomeAssistantRepository.ets | arkts | generateRandomEntities | ===== generators ===== | private generateRandomEntities(): EntityCard[] {
const out: EntityCard[] = [];
const lightsCount: number = this.randomIntInclusive(1, 2);
const locksCount: number = this.randomIntInclusive(1, 2);
const switchesCount: number = this.randomIntInclusive(1, 2);
let i: number = 1;
for (let n: numbe... | AST#method_declaration#Left private generateRandomEntities AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left EntityCard [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#vari... | private generateRandomEntities(): EntityCard[] {
const out: EntityCard[] = [];
const lightsCount: number = this.randomIntInclusive(1, 2);
const locksCount: number = this.randomIntInclusive(1, 2);
const switchesCount: number = this.randomIntInclusive(1, 2);
let i: number = 1;
for (let n: numbe... | https://github.com/gentslava/Home-Assistant-HarmonyOS-Next.git/blob/d8cf624f6d92bedac06380b01a77c3c51e55beb5/entry/src/main/ets/data/repository/MockHomeAssistantRepository.ets#L63-L86 | 094ed52f0db61c418c54ec289da4168255cacd3c | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ComponentReuse/entry/src/main/ets/model/BasicDataSource.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = [];
public abstract totalCount(): number;
public abstract getData(index: number): T | void;
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0... | AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declarat... | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = [];
public abstract totalCount(): number;
public abstract getData(index: number): T | void;
registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/model/BasicDataSource.ets#L16-L41 | 51d2375a0736ad7b912c78502d10a2bf60dae960 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/AES.ets | arkts | generateAESKey | 生成AES的对称密钥
@returns AES密钥 | static async generateAESKey(): Promise<string> {
return CryptoUtil.generateSymKey('AES256');
} | AST#method_declaration#Left static async generateAESKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > A... | static async generateAESKey(): Promise<string> {
return CryptoUtil.generateSymKey('AES256');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AES.ets#L66-L68 | aa81a3eddb3bc86634b2ccaee36bbc875d12828f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AuthUtil.ets | arkts | onStartEasy | 开始认证,使用指纹和密码认证
@param showTip 是否显示提示语
@param callBack | static onStartEasy(showTip: boolean = false, callBack: Callback<userAuth.UserAuthResult>) {
const options: AuthOptions = new AuthOptions();
LogUtil.error(JSON.stringify(options, null, 2));
options.showTip = showTip;
AuthUtil.onStart(options, callBack);
} | AST#method_declaration#Left static onStartEasy AST#parameter_list#Left ( AST#parameter#Left showTip : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#... | static onStartEasy(showTip: boolean = false, callBack: Callback<userAuth.UserAuthResult>) {
const options: AuthOptions = new AuthOptions();
LogUtil.error(JSON.stringify(options, null, 2));
options.showTip = showTip;
AuthUtil.onStart(options, callBack);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AuthUtil.ets#L58-L63 | bd796a61e18e28c23a0e368a5041ede19fdd6021 | gitee |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/model/Survey.ets | arkts | generateId | 生成唯一ID | private generateId(): string {
return 'q_' + Date.now() + '_' + Math.floor(Math.random() * 10000).toString();
} | AST#method_declaration#Left private generateId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_express... | private generateId(): string {
return 'q_' + Date.now() + '_' + Math.floor(Math.random() * 10000).toString();
} | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/model/Survey.ets#L43-L45 | 2398cf6a7cb8a4a8ea9bcbbce1da4bab6d0c9257 | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/view/AlarmClock/AlarmListItem.ets | arkts | 构建闹钟项视图 | build() {
Row() {
Column() {
// 闹钟时间文本
Text(this.mainModel.getTaskTimeContent(this.alarmItem.hour, this.alarmItem.minute))
.CommonTextAttr(DimensionUtil.getFp($r('app.float.alarms_item_time_font_size')),
FontWeight.Regular,
{ left: DimensionUtil.getVp($r('app.... | AST#build_method#Left build ( ) AST#build_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#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 闹钟时间文本 AST... | build() {
Row() {
Column() {
Text(this.mainModel.getTaskTimeContent(this.alarmItem.hour, this.alarmItem.minute))
.CommonTextAttr(DimensionUtil.getFp($r('app.float.alarms_item_time_font_size')),
FontWeight.Regular,
{ left: DimensionUtil.getVp($r('app.float.ala... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/AlarmClock/AlarmListItem.ets#L16-L59 | 93e7c5f13b3fef75946b17213cb3202bbc127e8d | github | |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/common/AccountData.ets | arkts | calculateTotalAssets | 计算总资产和总负债 | static async calculateTotalAssets(): Promise<AssetsSummary> {
const accounts = await AccountDataManager.getAllAccounts();
let totalAssets = 0;
let totalLiabilities = 0;
accounts.forEach(account => {
if (account.includeInTotal) {
const balance = parseFloat(account.balance) || 0;
if... | AST#method_declaration#Left static async calculateTotalAssets 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 AssetsSummary AST#primary_type#Right AST#type_annotat... | static async calculateTotalAssets(): Promise<AssetsSummary> {
const accounts = await AccountDataManager.getAllAccounts();
let totalAssets = 0;
let totalLiabilities = 0;
accounts.forEach(account => {
if (account.includeInTotal) {
const balance = parseFloat(account.balance) || 0;
if... | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L128-L146 | b81a24744c4f31a6ef7614d7a010a9a3e3b99ab4 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.router.d.ets | arkts | @typedef EnableAlertOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 8
@typedef EnableAlertOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 10
@typedef EnableAlertOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 11 | export interface EnableAlertOptions {
/**
* dialog context.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 8
*/
/**
* dialog context.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since ... | AST#export_declaration#Left export AST#interface_declaration#Left interface EnableAlertOptions AST#object_type#Left { /**
* dialog context.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 8
*/ /**
* dialog context.
*
* @type { string }
* @sysca... | export interface EnableAlertOptions {
message: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.router.d.ets#L327-L353 | 2959e10d0e70a41146459b62e9e3509bf9877b06 | gitee | |
sea5241/PictureSelector | 09bac407ebd61100d1ccbf6e6d3b6349cb0013d7 | selector/src/main/ets/components/ItemPicComponent.ets | arkts | ItemPicComponent | 图片组件
@Author sea
@Date 2024/7/8 | @Component
export struct ItemPicComponent {
// 图片数据
@Prop mediaData: MediaData;
// 图片样式
@Prop pictureItemData: PictureItemStyleData
// 是否选中
@Prop isSelected: boolean = false
// 最大选择数量
@Prop maxSelectCount: number
// 已选数量
@Prop selectCount: number
// 选择变化回调
selectChanged: (mediaData: MediaData, i... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ItemPicComponent AST#component_body#Left { // 图片数据 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right mediaData : AST#type_annotation#Left AST#primary_type#Left MediaData AST#primary_type#Righ... | @Component
export struct ItemPicComponent {
@Prop mediaData: MediaData;
@Prop pictureItemData: PictureItemStyleData
@Prop isSelected: boolean = false
@Prop maxSelectCount: number
@Prop selectCount: number
selectChanged: (mediaData: MediaData, isSelected: boolean) => void = () => {
}
b... | https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/components/ItemPicComponent.ets#L12-L70 | c975210708fb68e13fccf2bd0bba007bb1c97d33 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/EpisodeDetailPage.ets | arkts | checkDownloadStatus | 检查下载状态 | async checkDownloadStatus() {
if (this.episode) {
const status = this.episode.downloadStatus;
this.isDownloading = status === DownloadStatus.DOWNLOADING;
if (this.isDownloading) {
this.downloadProgress = this.episode.downloadProgress;
}
}
} | AST#method_declaration#Left async checkDownloadStatus AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episode AST#member_expression#Right AST#expre... | async checkDownloadStatus() {
if (this.episode) {
const status = this.episode.downloadStatus;
this.isDownloading = status === DownloadStatus.DOWNLOADING;
if (this.isDownloading) {
this.downloadProgress = this.episode.downloadProgress;
}
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/EpisodeDetailPage.ets#L53-L61 | 74f099938aaeba9b130c46abf9d55949da2c4eba | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets | arkts | getDataArray | 获取commentArray | public getDataArray(): Comment[] {
return this.commentArray;
} | AST#method_declaration#Left public getDataArray AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Comment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#L... | public getDataArray(): Comment[] {
return this.commentArray;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets#L73-L75 | 5c8c6cfbb6c97632bdca62121dacfa646f215e98 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets | arkts | 数组管理 | export default class ArrayUtil {
/**
* 删除数组中重复元素
* param 数组对象
* @returns Array
*/
static listNoRepeatDate<T>(list: T[]) {
if (null === list || undefined === list || list.length === 0) {
return;
}
return Array.from(new Set(list));
}
/**
* 判断数组不为空和未定义
* param 数组对象Array<Object>... | AST#export_declaration#Left export default AST#class_declaration#Left class ArrayUtil AST#class_body#Left { /**
* 删除数组中重复元素
* param 数组对象
* @returns Array
*/ AST#method_declaration#Left static listNoRepeatDate AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters... | export default class ArrayUtil {
static listNoRepeatDate<T>(list: T[]) {
if (null === list || undefined === list || list.length === 0) {
return;
}
return Array.from(new Set(list));
}
static isNotNullEmpty(list: Array<Object> | undefined): boolean {
return null !== list && undefined !=... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets#L20-L70 | 6a1721861613755a4506aeb01bfa448e0fb9d51c | gitee | |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/common/RdbHelper.ets | arkts | getDailySummaryByDate | Get daily summary for a specific date
@param date - Date string in YYYY-MM-DD format
@returns DailySummary or null | async getDailySummaryByDate(date: string): Promise<DailySummary | null> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_DAILY_SUMMARIES);
predicates.equalTo('date', date);
try {
const resultSet ... | AST#method_declaration#Left async getDailySummaryByDate AST#parameter_list#Left ( AST#parameter#Left date : 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_t... | async getDailySummaryByDate(date: string): Promise<DailySummary | null> {
if (!this.rdbStore) {
throw new Error('Database not initialized');
}
const predicates = new relationalStore.RdbPredicates(Constants.TABLE_DAILY_SUMMARIES);
predicates.equalTo('date', date);
try {
const resultSet ... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L798-L831 | 5de4b4a8aeffe6935c93679fed43f2fb8998df36 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets | arkts | queryAllCriticalAsset | [End update_critical_asset] [Start query_single_plaintext] | async function queryAllCriticalAsset(): Promise<string> {
let result: string = '';
let query: asset.AssetMap = new Map();
query.set(asset.Tag.ALIAS, stringToArray('demo_alias')); // 指定了关键资产别名,最多查询到一条满足条件的关键资产
query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ALL); // 此处表示需要返回关键资产的所有信息,即属性+明文
try {
await a... | AST#function_declaration#Left async function queryAllCriticalAsset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio... | async function queryAllCriticalAsset(): Promise<string> {
let result: string = '';
let query: asset.AssetMap = new Map();
query.set(asset.Tag.ALIAS, stringToArray('demo_alias'));
query.set(asset.Tag.RETURN_TYPE, asset.ReturnType.ALL);
try {
await asset.query(query).then((res: Array<asset.AssetMap>) => {... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets#L252-L276 | 4e26bc0d62315c33289fbe3479174535b768d6e4 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | Q1/HealthyDiet/entry/src/main/ets/pages/Index.ets | arkts | onPageShow | onPageShow => router: 'pages/Home' | onPageShow() {
setTimeout(() => {
router.pushUrl({url: 'pages/Home'})
}, 1000)
} | AST#method_declaration#Left onPageShow 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 setTimeout ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right =>... | onPageShow() {
setTimeout(() => {
router.pushUrl({url: 'pages/Home'})
}, 1000)
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/HealthyDiet/entry/src/main/ets/pages/Index.ets#L6-L10 | 67d67269ff5b3aa9ef8f40e9cd269e0ed257a795 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ar/ARCardService.ets | arkts | AR卡片数据接口 | export interface ARCardData {
id: string;
contactId: string;
sceneConfig: ARSceneConfig;
models: ARModel[];
interactions: ARInteractionConfig;
personalMessage: string;
voiceMessage?: string;
backgroundImage?: string;
qrCode: string;
shareUrl: string;
createdAt: string;
expiresAt?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ARCardData AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left contactId : AST#type_annotation#Left... | export interface ARCardData {
id: string;
contactId: string;
sceneConfig: ARSceneConfig;
models: ARModel[];
interactions: ARInteractionConfig;
personalMessage: string;
voiceMessage?: string;
backgroundImage?: string;
qrCode: string;
shareUrl: string;
createdAt: string;
expiresAt?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L262-L275 | 4caa673a20b3f7c8be36d1b6b1a435bdd35df9c9 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index.ets | arkts | add_index_string_full | Pushes a timestamp to the correct position of values of str (keys).
@param str the keys.
@param timestamp the timestamp. | static add_index_string_full(str: string, timestamp: number) {
// Divide into words
let all_words = divide_string(str.toUpperCase());
// Traverse and add
for (const item of all_words) {
let original = bunch_of_history_index.index_map.get(item) || new collections.Array<number>();
// concat i... | AST#method_declaration#Left static add_index_string_full 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 timestamp : AST#type_annotation#Left AST#primary_type#Left number AS... | static add_index_string_full(str: string, timestamp: number) {
let all_words = divide_string(str.toUpperCase());
for (const item of all_words) {
let original = bunch_of_history_index.index_map.get(item) || new collections.Array<number>();
bunch_of_history_index.index_map.set(item, ... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index.ets#L138-L149 | e5c94d62c47e0743f8a0d1a8df6f6575f9ce20dc | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/pages/MyDay.ets | arkts | ScheduleItemHeader | ScheduleItem 所在的 ListItemGroup 的标题组件。 | @Builder
private ScheduleItemHeader(): void {
Row() {
Text('已完成')
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r('app.color.font_black'));
}
.enabled(!this.isBatchEdit)
.padding('1%')
.size({ width: '96%', height: '4%' })
.border({
radius: 12,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ScheduleItemHeader AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left A... | @Builder
private ScheduleItemHeader(): void {
Row() {
Text('已完成')
.fontWeight(FontWeight.Medium)
.fontSize(14)
.fontColor($r('app.color.font_black'));
}
.enabled(!this.isBatchEdit)
.padding('1%')
.size({ width: '96%', height: '4%' })
.border({
radius: 12,
... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L546-L571 | 007b669c5d2fefce2871415dc3b8929a9c91d1ff | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets | arkts | @file 商品相关数据源实现类
@author Joker.X | export class GoodsNetworkDataSourceImpl implements GoodsNetworkDataSource {
/**
* 分页查询商品
* @param params 商品搜索请求参数
* @returns 商品分页数据响应
*/
async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Goods>... | AST#export_declaration#Left export AST#class_declaration#Left class GoodsNetworkDataSourceImpl AST#implements_clause#Left implements GoodsNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 分页查询商品
* @param params 商品搜索请求参数
* @returns 商品分页数据响应
*/ AST#method_declaration#Left async getGood... | export class GoodsNetworkDataSourceImpl implements GoodsNetworkDataSource {
async getGoodsPage(params: GoodsSearchRequest): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Goods>>> =
await NetworkClient.http.post("goods/info/page", params);
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets#L12-L34 | c55bc27dc8c1b7cab82fcdf45c25f0a9aeed85cd | github | |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/TABS.ets | arkts | handleTabChange | Tab切换逻辑 | private handleTabChange(index: number) {
animateTo({
duration: 150,
curve: Curve.EaseOut
}, () => {
this.currentIndex = index;
this.iconScales = [1, 1, 1, 1];
this.iconScales[index] = 1.2;
});
} | AST#method_declaration#Left private handleTabChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statemen... | private handleTabChange(index: number) {
animateTo({
duration: 150,
curve: Curve.EaseOut
}, () => {
this.currentIndex = index;
this.iconScales = [1, 1, 1, 1];
this.iconScales[index] = 1.2;
});
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/TABS.ets#L26-L35 | 7692f917d8c9f82e483ac3cd3dc7cfd5f003e40c | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/RepeatIntervalDialog.ets | arkts | aboutToAppear | 将进入页面时的重复周期复制到临时重复周期。 | public aboutToAppear(): void {
this.tmpRepeatInterval = ArrayUtil.copy(this.repeatInterval);
} | AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left A... | public aboutToAppear(): void {
this.tmpRepeatInterval = ArrayUtil.copy(this.repeatInterval);
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/RepeatIntervalDialog.ets#L25-L27 | 5f940738a569a2384db6eeeb3b435f576994e02b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LLMConfigPage.ets | arkts | buildModelSelection | 构建模型选择区域 | @Builder
buildModelSelection() {
if (this.hasProviderModels()) {
Row() {
ForEach(this.getProviderModels(), (model: string) => {
Text(model)
.fontSize(12)
.fontColor(this.model === model ? '#ffffff' : '#666666')
.backgroundColor(this.model === model ? '#0... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildModelSelection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expres... | @Builder
buildModelSelection() {
if (this.hasProviderModels()) {
Row() {
ForEach(this.getProviderModels(), (model: string) => {
Text(model)
.fontSize(12)
.fontColor(this.model === model ? '#ffffff' : '#666666')
.backgroundColor(this.model === model ? '#0... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L499-L518 | cb29e06799bc64377a4621041f2b38db07817077 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets | arkts | get | 获取数据
@param key 键
@param defaultValue 默认值
@returns 存储的值 | public async get(key: string, defaultValue: string = ''): Promise<string> {
try {
await this.ensureInitialized();
const value = await this.preferences?.get(key, defaultValue);
return value as string;
} catch (error) {
console.error(`获取数据失败: ${key}`, error);
return defaultValue;
... | AST#method_declaration#Left public async get 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#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | public async get(key: string, defaultValue: string = ''): Promise<string> {
try {
await this.ensureInitialized();
const value = await this.preferences?.get(key, defaultValue);
return value as string;
} catch (error) {
console.error(`获取数据失败: ${key}`, error);
return defaultValue;
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/StorageUtils.ets#L57-L66 | f62d07134866b85873ddc253eb508b302288471a | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/model/ImageEditModel.ets | arkts | 画刷尺寸大小
不同的尺寸会反映到马赛克路径尺寸上 | export enum BrushSize {
tiny = 12,
small = 16,
big = 20,
large = 24,
huge = 28
} | AST#export_declaration#Left export AST#enum_declaration#Left enum BrushSize AST#enum_body#Left { AST#enum_member#Left tiny = AST#expression#Left 12 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left small = AST#expression#Left 16 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left big = AST... | export enum BrushSize {
tiny = 12,
small = 16,
big = 20,
large = 24,
huge = 28
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/model/ImageEditModel.ets#L147-L153 | 34ec48009f675bf12e37879b06daa7af16e8b6ca | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | buildSettingItem | 构建设置项 | @Builder
buildSettingItem(title: string, description: string, value: boolean, onChanged: (value: boolean) => void) {
Row({ space: 16 }) {
Column({ space: 4 }) {
Text(title)
.fontSize(14)
.fontColor($r('app.color.text_primary'))
.alignRules({ left: { anchor: '__container... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annota... | @Builder
buildSettingItem(title: string, description: string, value: boolean, onChanged: (value: boolean) => void) {
Row({ space: 16 }) {
Column({ space: 4 }) {
Text(title)
.fontSize(14)
.fontColor($r('app.color.text_primary'))
.alignRules({ left: { anchor: '__container... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/settings/LanguageSettingsPage.ets#L459-L486 | 14460c33c6e6c480437a1ced428cccaa72375aa2 | github |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/view/TopicDetailItemWidget.ets | arkts | play | 播放 | play(): void {
if (this.playState !== PlayState.START) {
this.playState = PlayState.START;
}
this.videoController.start();
} | AST#method_declaration#Left play AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#L... | play(): void {
if (this.playState !== PlayState.START) {
this.playState = PlayState.START;
}
this.videoController.start();
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/view/TopicDetailItemWidget.ets#L153-L158 | 2bbdaf30ae41fef2702164efec2bac448f927d09 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/customComponent.d.ets | arkts | aboutToRecycle | aboutToRecycle Method.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | aboutToRecycle(): void; | AST#method_declaration#Left aboutToRecycle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | aboutToRecycle(): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/customComponent.d.ets#L201-L201 | 2de82617240fd9479b1bbfc75f43a1d336876573 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | mime_types/src/main/ets/Mime.ets | arkts | getTypeDescriptorByMIMEType | 根据文件MIME类型,获取TypeDescriptor(标准化数据类型的描述类)
@param mimeType MIME类型名称,例如:'image/jpeg' 'image/png' | static getTypeDescriptorByMIMEType(mimeType: string): uniformTypeDescriptor.TypeDescriptor {
const dataType = uniformTypeDescriptor.getUniformDataTypeByMIMEType(mimeType);
const typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(dataType);
return typeDescriptor;
} | AST#method_declaration#Left static getTypeDescriptorByMIMEType AST#parameter_list#Left ( AST#parameter#Left mimeType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | static getTypeDescriptorByMIMEType(mimeType: string): uniformTypeDescriptor.TypeDescriptor {
const dataType = uniformTypeDescriptor.getUniformDataTypeByMIMEType(mimeType);
const typeDescriptor = uniformTypeDescriptor.getTypeDescriptor(dataType);
return typeDescriptor;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/mime_types/src/main/ets/Mime.ets#L115-L119 | ffc860fb4df0de1593cce2541b7f489bf2864695 | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | Compute absolute end time (epoch ms) on the timeline base.
@param baseMs Timeline base epoch ms.
@param infos Video list.
@param timelineStarts Start offsets per segment.
@returns Absolute end time in epoch ms. | export function computeTimelineEndAbs(baseMs: number, infos: VideoInfo[], timelineStarts: number[]): number {
return baseMs + computeTimelineEndOffset(infos, timelineStarts);
} | AST#export_declaration#Left export AST#function_declaration#Left function computeTimelineEndAbs AST#parameter_list#Left ( AST#parameter#Left baseMs : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left infos : AST#type_annotatio... | export function computeTimelineEndAbs(baseMs: number, infos: VideoInfo[], timelineStarts: number[]): number {
return baseMs + computeTimelineEndOffset(infos, timelineStarts);
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L275-L277 | 697fd4c23da558bbe083d1ee8bf2019eadd009f5 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/DeleteListItem.ets | arkts | DeleteListItem | [End enter_edit_mode] | @Entry
@Component
export struct DeleteListItem {
@State arr: number[] = [0, 1, 2, 3];
@State toDoData: ToDo[] = [];
@Watch('onEditModeChange') @State isEditMode: boolean = false;
@State selectedItems: ToDo[] = [];
private availableThings: string[] = ['Reading', 'Exercise', 'Travel', 'Listening Music', 'Watchi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct DeleteListItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right arr : AST#type_annotation#Left AST#primary_type#Left... | @Entry
@Component
export struct DeleteListItem {
@State arr: number[] = [0, 1, 2, 3];
@State toDoData: ToDo[] = [];
@Watch('onEditModeChange') @State isEditMode: boolean = false;
@State selectedItems: ToDo[] = [];
private availableThings: string[] = ['Reading', 'Exercise', 'Travel', 'Listening Music', 'Watchi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/list/DeleteListItem.ets#L70-L173 | 066b46989dea5830ee30dd3f7d7ac40bd56bd4bf | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | firstApiVersion | 首个版本系统软件API版本 | static firstApiVersion(): string {
return deviceInfo.firstApiVersion + ''
} | AST#method_declaration#Left static firstApiVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_e... | static firstApiVersion(): string {
return deviceInfo.firstApiVersion + ''
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L175-L177 | 66d7d46e3c371ab61072d1a264e23d950c9ad52f | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement1.ets | arkts | additionDelay | [EndExclude seq_runner] | @Concurrent
function additionDelay(delay: number): void {
let start: number = new Date().getTime();
while (new Date().getTime() - start < delay) {
continue;
}
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function additionDelay AST#parameter_list#Left ( AST#parameter#Left delay : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : ... | @Concurrent
function additionDelay(delay: number): void {
let start: number = new Date().getTime();
while (new Date().getTime() - start < delay) {
continue;
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement1.ets#L28-L34 | f405be6c93a0a547553e44b7930031517280e877 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/MessageUtil.ets | arkts | basicView | 基础的视图
@param messageCfg
@param defaultIcon
@param defaultTxtColor
@param defaultBgColor
@param defaultBorderColor | @Builder
function basicView(messageCfg: MessageCfg, defaultIcon: ResourceStr, defaultTxtColor: string, defaultBgColor: string,
defaultBorderColor: string) {
Row() {
Row() {
Image(messageCfg.icon ? messageCfg.icon : defaultIcon).icon()
Text(messageCfg.message).txtStyle(defaultTxtColor)
}
if ... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function basicView AST#parameter_list#Left ( AST#parameter#Left messageCfg : AST#type_annotation#Left AST#primary_type#Left MessageCfg AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaul... | @Builder
function basicView(messageCfg: MessageCfg, defaultIcon: ResourceStr, defaultTxtColor: string, defaultBgColor: string,
defaultBorderColor: string) {
Row() {
Row() {
Image(messageCfg.icon ? messageCfg.icon : defaultIcon).icon()
Text(messageCfg.message).txtStyle(defaultTxtColor)
}
if ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L175-L199 | 9c9a976bb8b9ad17aa5499a8e065fa9207f7093f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/BindSheet/entry/src/main/ets/pages/bindContentCover/template6/Index.ets | arkts | MySheetBuilder | 第二步:定义半模态展示界面 通过@Builder构建模态展示界面 | @Builder
MySheetBuilder() {
Column() {
Column() {
this.TripInfo()
}
.width('92%')
.margin(15)
.backgroundColor(Color.White)
.shadow({ radius: 30, color: '#aaaaaa' })
.borderRadius(10)
Column() {
Text($r('app.string.MySheetBuilder_text1'))
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right MySheetBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_e... | @Builder
MySheetBuilder() {
Column() {
Column() {
this.TripInfo()
}
.width('92%')
.margin(15)
.backgroundColor(Color.White)
.shadow({ radius: 30, color: '#aaaaaa' })
.borderRadius(10)
Column() {
Text($r('app.string.MySheetBuilder_text1'))
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/BindSheet/entry/src/main/ets/pages/bindContentCover/template6/Index.ets#L146-L178 | b1fad4da3cc9f069d7ff685fd6a9df7c929e434d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/entryability/EntryAbility.ets | arkts | onMemoryLevel | 内存级别警告回调
@param level 内存警告级别 | onMemoryLevel(level: AbilityConstant.MemoryLevel): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'Ability onMemoryLevel: %{public}d', level);
// 根据内存级别进行相应处理
this.handleMemoryWarning(level);
} | AST#method_declaration#Left onMemoryLevel AST#parameter_list#Left ( AST#parameter#Left level : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConstant . MemoryLevel AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A... | onMemoryLevel(level: AbilityConstant.MemoryLevel): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'Ability onMemoryLevel: %{public}d', level);
this.handleMemoryWarning(level);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L107-L113 | a52b26b46cd8f2e38838feaaace2be2bee99dd64 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | getInstance | 获取单例实例 | static getInstance(): LunarService {
if (!LunarService.instance) {
LunarService.instance = new LunarService();
}
return LunarService.instance;
} | AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LunarService AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left A... | static getInstance(): LunarService {
if (!LunarService.instance) {
LunarService.instance = new LunarService();
}
return LunarService.instance;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L134-L139 | fed3856d5edc9f1390c21872e5f121c9d22a4b91 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinBMI/entry/src/main/ets/model/DxinBmiModel.ets | arkts | Bmi表 | export class BmiTable {
min: number
max: number
tag: string
flagColor: string
proportion: string // 占比
suggestion:string // 当前建议
constructor | AST#export_declaration#Left export AST#ERROR#Left class BmiTable { min : AST#ERROR#Left number max : number tag : string flagColor : string proportion : string // 占比 suggestion : AST#ERROR#Right string AST#ERROR#Right // 当前建议 AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarato... | export class BmiTable {
min: number
max: number
tag: string
flagColor: string
proportion: string
suggestion:string
constructor | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/model/DxinBmiModel.ets#L29-L37 | bb5aeb299b559ed9519708cb3102addd4ada7359 | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/RegexUtils.ets | arkts | isPhone | 判断传入的电话号码格式是否正确。
@param phone 电话号码 | static isPhone(phone: string): boolean {
return FormatUtils.isPhone(phone);
} | AST#method_declaration#Left static isPhone AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#... | static isPhone(phone: string): boolean {
return FormatUtils.isPhone(phone);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/RegexUtils.ets#L198-L200 | f1d6723a8ee11e44b5a6bf16efa287597c58bd96 | gitee |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets | arkts | Implements a rounded rectangle.
@syscap SystemCapability.Graphics.Drawing
@since 12 | export class RoundRect {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | AST#export_declaration#Left export AST#class_declaration#Left class RoundRect AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_li... | export class RoundRect {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L1261-L1262 | c78732b50edabcbddaa95777c2dc30612f246f25 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/ImageUtil.ets | arkts | createImageSource | 创建图片源实例
@param src
options SourceOptions 图片属性,包括图片像素密度、像素格式和图片尺寸。
@returns | static createImageSource(target: string | number | ArrayBuffer | resourceManager.RawFileDescriptor,
options?: image.SourceOptions): OutDTO<image.ImageSource> {
if (typeof target === 'string') {
if (options) {
return OutDTO.OKByDataRow('创建图片资源成功~', image.createImageSource(target, options));
}... | AST#method_declaration#Left static createImageSource AST#parameter_list#Left ( AST#parameter#Left target : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left ArrayBuffer AST#primary_type#Right | A... | static createImageSource(target: string | number | ArrayBuffer | resourceManager.RawFileDescriptor,
options?: image.SourceOptions): OutDTO<image.ImageSource> {
if (typeof target === 'string') {
if (options) {
return OutDTO.OKByDataRow('创建图片资源成功~', image.createImageSource(target, options));
}... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L226-L253 | 1e5c39844b6224e5f1a9501bd8aa4a2f40fa5759 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets | arkts | mediaPreview为需要获取的视频预览图url | constructor(id: string, user: UserItem, text: string, media: string, mediaPreview: string) {
this.id = id;
this.user = user;
this.media = media;
this.mediaPreview = mediaPreview;
this.text = text;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left UserItem AST#primary_type#R... | constructor(id: string, user: UserItem, text: string, media: string, mediaPreview: string) {
this.id = id;
this.user = user;
this.media = media;
this.mediaPreview = mediaPreview;
this.text = text;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/model/BasicDataSource.ets#L128-L134 | 5147d47d9dcfff3d588951e2cedab6c6f598cf79 | gitee | |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPWindowUtils.ets | arkts | 修改状态栏颜色 | export class DMPWindowUtil {
public static getWindowBottomSafeArea(windowStage: window.WindowStage, bottomSafeArea: boolean): number {
let bottomSafeHeight = -1;
if (!bottomSafeArea) {
bottomSafeHeight = 0
return bottomSafeHeight
}
bottomSafeHeight = DMPWindowUtil.getBottomSafeArea(windowS... | AST#export_declaration#Left export AST#class_declaration#Left class DMPWindowUtil AST#class_body#Left { AST#method_declaration#Left public static getWindowBottomSafeArea AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage... | export class DMPWindowUtil {
public static getWindowBottomSafeArea(windowStage: window.WindowStage, bottomSafeArea: boolean): number {
let bottomSafeHeight = -1;
if (!bottomSafeArea) {
bottomSafeHeight = 0
return bottomSafeHeight
}
bottomSafeHeight = DMPWindowUtil.getBottomSafeArea(windowS... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPWindowUtils.ets#L8-L85 | d6ae6cf859ea4d4461234af74970673be982cf50 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets | arkts | setVoiceScene | 设置通话场景 | setVoiceScene(calling: boolean): void {
AudioManagerModel.setVoiceScene(calling);
} | AST#method_declaration#Left setVoiceScene AST#parameter_list#Left ( AST#parameter#Left calling : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | setVoiceScene(calling: boolean): void {
AudioManagerModel.setVoiceScene(calling);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/IndexController.ets#L156-L158 | 2a27d936c927f6b9c1a077ae03b99276665fa85c | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets | arkts | 根据ID获取任务详情
@param taskId 任务ID
@returns 任务详情 | export function getTaskById(taskId: number): Promise<Task> {
try {
return request<Task>(
RequestMethod.GET,
`/tasks/${taskId}`
);
} catch (error) {
console.error(`获取任务详情失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取任务详情失败: ${error instanceof Error ? ... | AST#export_declaration#Left export AST#function_declaration#Left function getTaskById AST#parameter_list#Left ( AST#parameter#Left taskId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST... | export function getTaskById(taskId: number): Promise<Task> {
try {
return request<Task>(
RequestMethod.GET,
`/tasks/${taskId}`
);
} catch (error) {
console.error(`获取任务详情失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取任务详情失败: ${error instanceof Error ? ... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L252-L262 | 4bc4928525ae3324dc686b8313a877f23ec670e6 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/BarChartModel.ets | arkts | groupBars | Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries.
Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified
by the parameters.
Calls notifyDataSetChanged() afterwards.
@param fromX the starting point on the x-ax... | public groupBars(fromX: number, groupSpace: number, barSpace: number): void {
if (this.getBarData() == null) {
throw new Error("You need to set data for the chart before grouping bars.");
} else {
let barData: BarData | null = this.getBarData();
if (barData) {
barData.groupBars(fromX,... | AST#method_declaration#Left public groupBars AST#parameter_list#Left ( AST#parameter#Left fromX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left groupSpace : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | public groupBars(fromX: number, groupSpace: number, barSpace: number): void {
if (this.getBarData() == null) {
throw new Error("You need to set data for the chart before grouping bars.");
} else {
let barData: BarData | null = this.getBarData();
if (barData) {
barData.groupBars(fromX,... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L293-L304 | 44c62e54c3f07a5696e3b2e6086c2099f67ba576 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_asynchronous.ets | arkts | decryptMessagePromise | 分段解密消息 | async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let updateLength = 20; // 假设以20字节为单位进行分段update,实际并无要求
let ... | AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let updateLength = 20;
let decryptText = new Uint8Array()... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM4ArkTs/entry/src/main/ets/pages/sm4_gcm_seg_encryption_decryption/sm4_gcm_seg_encryption_decryption_asynchronous.ets#L71... | 3df57b9f379e2e02b8e20a5cccbc433a311b39eb | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Sync.ets | arkts | genRsa2048PubKeySpec | 根据密钥参数构造RSA公钥规范对象 | function genRsa2048PubKeySpec() {
let nIn =
BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc43' +
'28daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee34' +
'e4d933c868187bdc26f7be07149... | AST#function_declaration#Left function genRsa2048PubKeySpec AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left nIn = AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right... | function genRsa2048PubKeySpec() {
let nIn =
BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc43' +
'28daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee34' +
'e4d933c868187bdc26f7be07149... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Sync.ets#L36-L45 | b493dc6190081918da0dded4b9d796f9b8eaab40 | gitee |
AlbertZyc/tab-layout | 4ba256eead3792c84128f8679b26ac159a2d7f06 | entry/src/main/ets/BasicDataSource.ets | arkts | registerDataChangeListener | 该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听 | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
} | AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef... | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
} | https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L23-L27 | 5bf18bd5acb57d017967cbe20a742fc0a4d75947 | gitee |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Pointer.ets | arkts | get | Returns the size of this map (only counting active pointers). This value is anywhere
between 0 and [capacity]. | get size(): number {
let count = 0;
for (let pointer of this.pointers) {
if (pointer.isUsed) {
count++;
}
}
return count;
} | AST#method_declaration#Left get AST#ERROR#Left size AST#ERROR#Right 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_d... | get size(): number {
let count = 0;
for (let pointer of this.pointers) {
if (pointer.isUsed) {
count++;
}
}
return count;
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L110-L118 | cb30d940cdcdd36003e0707de30e64002d5f2390 | github |
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git | 3b5fa45c650dcae2773a19f122161935e0c0e2bc | entry/src/main/ets/pages/customScan/model/ScanSize.ets | arkts | Area information after the window is refreshed. | constructor() {
this.navHeight = CommonConstants.TABLET_NAV_HEIGHT;
this.xComponentSize = new XComponentSize();
this.deviceStatus = new DeviceStatus();
this.newArea = new NewArea();
this.scanLayout = new ScanLayout(this.navHeight);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . navHeight AST#member... | constructor() {
this.navHeight = CommonConstants.TABLET_NAV_HEIGHT;
this.xComponentSize = new XComponentSize();
this.deviceStatus = new DeviceStatus();
this.newArea = new NewArea();
this.scanLayout = new ScanLayout(this.navHeight);
} | https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/model/ScanSize.ets#L142-L148 | 2d5c804858bb2fac2acd71a70e0edefbd964a36d | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customtabbar/src/main/ets/model/DataType.ets | arkts | TabBar data type.
@param id: 页签id
@param title: 页签名称
@param selectedIcon: 被选中图片
@param defaultIcon: 默认图片
@param selectedFontColor: 被选中页签文本颜色
@param defaultFontColor: 默认页签文本颜色 | export class TabBarInfo {
id: number;
title: ResourceStr;
selectedIcon: ResourceStr;
defaultIcon: ResourceStr;
selectedFontColor: ResourceColor;
defaultFontColor: ResourceColor;
constructor(id: number, title: ResourceStr, selectedIcon: ResourceStr, defaultIcon: ResourceStr,
selectedFontColor: Resourc... | AST#export_declaration#Left export AST#class_declaration#Left class TabBarInfo 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#property_declaration#Right AST#property_declaration#Left title : AST#type_a... | export class TabBarInfo {
id: number;
title: ResourceStr;
selectedIcon: ResourceStr;
defaultIcon: ResourceStr;
selectedFontColor: ResourceColor;
defaultFontColor: ResourceColor;
constructor(id: number, title: ResourceStr, selectedIcon: ResourceStr, defaultIcon: ResourceStr,
selectedFontColor: Resourc... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customtabbar/src/main/ets/model/DataType.ets#L26-L43 | 837419327e55ccb2555ab77d610d125d53fdba47 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customview/src/main/ets/view/CustomView.ets | arkts | getTransitionX | 获取颜色条偏移量 | getTransitionX(index: number) {
let theNumber: number = 0;
for (let i = this.loopDefault; i <= index; i++) {
const title = this.titleArray[i];
const titleLength = title.length * this.titleLengthRadix;
if (i === index) {
theNumber += titleLength / this.titleLengthHalf - this.colorBarHal... | AST#method_declaration#Left getTransitionX 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef... | getTransitionX(index: number) {
let theNumber: number = 0;
for (let i = this.loopDefault; i <= index; i++) {
const title = this.titleArray[i];
const titleLength = title.length * this.titleLengthRadix;
if (i === index) {
theNumber += titleLength / this.titleLengthHalf - this.colorBarHal... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customview/src/main/ets/view/CustomView.ets#L84-L96 | b1e4646c1f3a07745703d6b1751266eb1ecf50d7 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/navigation/DemoGraph.ets | arkts | @file Demo 模块导航图
@author Joker.X | export class DemoGraph implements RouteGraph {
/**
* 注册 Demo 模块导航路由
* @returns {void} 无返回值
*/
register(): void {
RouteBuild.register(DemoRoutes.NetworkDemo, wrapBuilder(NetworkDemoNav));
RouteBuild.register(DemoRoutes.NetworkListDemo, wrapBuilder(NetworkListDemoNav));
RouteBuild.register(DemoRo... | AST#export_declaration#Left export AST#class_declaration#Left class DemoGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册 Demo 模块导航路由
* @returns {void} 无返回值
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Rig... | export class DemoGraph implements RouteGraph {
register(): void {
RouteBuild.register(DemoRoutes.NetworkDemo, wrapBuilder(NetworkDemoNav));
RouteBuild.register(DemoRoutes.NetworkListDemo, wrapBuilder(NetworkListDemoNav));
RouteBuild.register(DemoRoutes.Database, wrapBuilder(DatabaseNav));
RouteBuil... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/DemoGraph.ets#L18-L35 | 1206e0031d0fa56f59daa9ba91a0836c8f213bf0 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets | arkts | createTable | 创建数据库表 | private async createTable(): Promise<void> {
logger.info(TAG, 'create table begin');
try {
// 执行sql语句,联系人个各个属性设定
if (this.rdbStore != undefined) {
await this.rdbStore.executeSql(SQL_CREATE_TABLE)
logger.info(TAG, 'create table succeed');
return;
}
} catch (err) {
... | AST#method_declaration#Left private async createTable 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#t... | private async createTable(): Promise<void> {
logger.info(TAG, 'create table begin');
try {
if (this.rdbStore != undefined) {
await this.rdbStore.executeSql(SQL_CREATE_TABLE)
logger.info(TAG, 'create table succeed');
return;
}
} catch (err) {
logger.error(TAG,... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L77-L90 | c1a0f824ec4cfe59090dd1bf4203ea57ed01b05d | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/wordcard/WordCardOne.ets | arkts | buildDeletedLabel | 构建已删除标签 | @Builder
buildDeletedLabel() {
Row(){
Text($r('app.string.word_delete_lbl_txt_deleted')) //已删除
.fontSize(25)
.fontColor('#FF0000')
.textAlign(TextAlign.Center)
.padding(10)
.borderRadius(15)
.border({ width: 2, color: '#FF0000' })
}
.justifyContent(Fle... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDeletedLabel 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_e... | @Builder
buildDeletedLabel() {
Row(){
Text($r('app.string.word_delete_lbl_txt_deleted'))
.fontSize(25)
.fontColor('#FF0000')
.textAlign(TextAlign.Center)
.padding(10)
.borderRadius(15)
.border({ width: 2, color: '#FF0000' })
}
.justifyContent(FlexAlig... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L455-L469 | b2e134e88bd9f2d1cc4ae6357de478e65987829c | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Shopping/OrangeShopping/feature/emitter/index.ets | arkts | EmitterClass | 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 { EmitterClass, EventsData } from './src/main/ets/components/feature/EmitterClass' | AST#export_declaration#Left export { EmitterClass , EventsData } from './src/main/ets/components/feature/EmitterClass' AST#export_declaration#Right | export { EmitterClass, EventsData } from './src/main/ets/components/feature/EmitterClass' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/emitter/index.ets#L16-L16 | 9125d7a041a30fedc8632e68c728cac60a607d07 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/utils/PhotoHelperPage.ets | arkts | showAssetsCreationDialog | 弹窗授权保存,图片保存进相册。 | showAssetsCreationDialog(){
let uri = FileUtil.getUriFromPath(this.filePath);
let uri2 = FileUtil.getUriFromPath(this.filePath2);
PhotoHelper.showAssetsCreationDialogEasy([uri, uri2]).then((result) => {
this.uriStr = `图片保存成功,返回uris:\n${JSON.stringify(result, null, 2)}`;
LogUtil.error(this.uriStr... | AST#method_declaration#Left showAssetsCreationDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uri = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp... | showAssetsCreationDialog(){
let uri = FileUtil.getUriFromPath(this.filePath);
let uri2 = FileUtil.getUriFromPath(this.filePath2);
PhotoHelper.showAssetsCreationDialogEasy([uri, uri2]).then((result) => {
this.uriStr = `图片保存成功,返回uris:\n${JSON.stringify(result, null, 2)}`;
LogUtil.error(this.uriStr... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/utils/PhotoHelperPage.ets#L174-L185 | e33fbec3b10e468771f14a1a35ffb9a724f6bfa9 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringDealUtility.ets | arkts | clipIfNeeds | / 截取指定长度(默认最大部分数) | public static clipIfNeeds(srcStr: string): string | null {
return StringDealUtility.clipIfNeedsWithMax(
srcStr,
Constants.TitleTextJp.wordsMaxPart
);
} | AST#method_declaration#Left public static clipIfNeeds AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_typ... | public static clipIfNeeds(srcStr: string): string | null {
return StringDealUtility.clipIfNeedsWithMax(
srcStr,
Constants.TitleTextJp.wordsMaxPart
);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L81-L86 | c6d622f459f5deceb9324c49f437bc6922d64882 | github |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/InterviewRecordModel.ets | arkts | isUpcoming | 检查是否是即将到来的面试(7天内) | isUpcoming(): boolean {
if (!this.interviewDate || this.status !== InterviewStatus.SCHEDULED) return false;
const interviewTime = new Date(this.interviewDate).getTime();
const now = new Date().getTime();
const sevenDaysLater = now + 7 * 24 * 60 * 60 * 1000;
return interviewTime >= now && interviewTi... | AST#method_declaration#Left isUpcoming AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AS... | isUpcoming(): boolean {
if (!this.interviewDate || this.status !== InterviewStatus.SCHEDULED) return false;
const interviewTime = new Date(this.interviewDate).getTime();
const now = new Date().getTime();
const sevenDaysLater = now + 7 * 24 * 60 * 60 * 1000;
return interviewTime >= now && interviewTi... | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L243-L249 | bf3fe9324912e56fdc705cd084351dd8446c4dc7 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/DataSyncVerifier.ets | arkts | verifyDataSync | 验证数据同步完整性 | async verifyDataSync(): Promise<string[]> {
const results: string[] = [];
try {
results.push('🔍 开始验证数据同步完整性...');
// 1. 验证任务数据
const allTasks = this.taskViewModel.getAllTasks();
const taskStats = this.taskViewModel.getTaskStats();
results.push(`📋 任务数据验证:`);
results.push(... | AST#method_declaration#Left async verifyDataSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_ty... | async verifyDataSync(): Promise<string[]> {
const results: string[] = [];
try {
results.push('🔍 开始验证数据同步完整性...');
const allTasks = this.taskViewModel.getAllTasks();
const taskStats = this.taskViewModel.getTaskStats();
results.push(`📋 任务数据验证:`);
results.push(` - 总任务数: $... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DataSyncVerifier.ets#L154-L244 | 035043b9e38559aa7f70d131141d08b6d18f0bbd | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | 视频播放状态 | export class MediaPlayerStatus {
redLineProgress: number = 0; // [0,1]
isPlaying: boolean = false; // true播放 false暂停
} | AST#export_declaration#Left export AST#class_declaration#Left class MediaPlayerStatus AST#class_body#Left { AST#property_declaration#Left redLineProgress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_d... | export class MediaPlayerStatus {
redLineProgress: number = 0;
isPlaying: boolean = false;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L31-L34 | 91cabd796197dc937af8cee56e3db3271ff43f7b | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets | arkts | leftThumbUpdate | 左边条状物被滑动时的位置处理
@param deltaX | leftThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
// 左边距
if (deltaPx <= 0 && ((this.leftThumbRect[0] + deltaPx) <= this.leftPadding)) {
deltaPx = this.leftPadding - this.leftThumbRect[0];
}
// 右边距
if (deltaPx >= 0 && ((this.leftThumbRect[2] + deltaPx) >= (this.rightThumbRect[0] - th... | AST#method_declaration#Left leftThumbUpdate AST#parameter_list#Left ( AST#parameter#Left deltaX : 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#variable_declaration#L... | leftThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
if (deltaPx <= 0 && ((this.leftThumbRect[0] + deltaPx) <= this.leftPadding)) {
deltaPx = this.leftPadding - this.leftThumbRect[0];
}
if (deltaPx >= 0 && ((this.leftThumbRect[2] + deltaPx) >= (this.rightThumbRect[0] - this.minLeftRi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L241-L267 | eedeb9aebc70137108c259ecf788cca5148be14d | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | hasDirPath | 判断是否是完整路径
@param path 文件路径 | static hasDirPath(path: string): boolean {
return Helper.startsWith(path, "/data/storage/") || Helper.startsWith(path, "/storage/");
} | AST#method_declaration#Left static hasDirPath AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | static hasDirPath(path: string): boolean {
return Helper.startsWith(path, "/data/storage/") || Helper.startsWith(path, "/storage/");
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L241-L243 | b1cc5a3bf33190ca39e7137bd0acde05382a9260 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/constraint.ets | arkts | string类型Callback | export declare type StringCalBack = (content: string) => void; | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type StringCalBack = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation... | export declare type StringCalBack = (content: string) => void; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/constraint.ets#L13-L13 | c40126b4c004e7b9badc192c74d6cf02570bfb5f | gitee | |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | ‘5%’ | export const THOUSANDTH_66: string = '6.6%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_66 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '6.6%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const THOUSANDTH_66: string = '6.6%'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L50-L50 | 5e8bd68cf1f49cab8ad0fcc635da389ce9068f03 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets | arkts | selectFile | 选择文件 | async selectFile() {
let selectFile = ""
let documentPicker = new picker.DocumentViewPicker();
await documentPicker.select().then((result) => {
if (result.length > 0) {
selectFile = result[0]
this.msgHistory += "select file: " + selectFile + "\r\n";
}
}).catch((err: BusinessE... | AST#method_declaration#Left async selectFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left selectFile = AST#expression#Left "" AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#... | async selectFile() {
let selectFile = ""
let documentPicker = new picker.DocumentViewPicker();
await documentPicker.select().then((result) => {
if (result.length > 0) {
selectFile = result[0]
this.msgHistory += "select file: " + selectFile + "\r\n";
}
}).catch((err: BusinessE... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets#L169-L181 | 1ec032e9211fb1e52a9ec4c267294a819385fe3f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/DateHelper.ets | arkts | containsDay | 是否包含日 | static containsDay(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Ymd;
} | AST#method_declaration#Left static containsDay AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_... | static containsDay(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Ymd;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L84-L87 | 9219ddc23b1a3b7d002b02840f6fd08794c40096 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/components/Component.ets | arkts | aboutToAppear | 窗口管理model | aboutToAppear(): void {
// 获取顶部导航栏高度
this.windowModel.getStatusBarHeight((statusBarHeight) => {
this.statusBarHeight = px2vp(statusBarHeight);
})
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 获取顶部导航栏高度 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left A... | aboutToAppear(): void {
this.windowModel.getStatusBarHeight((statusBarHeight) => {
this.statusBarHeight = px2vp(statusBarHeight);
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/components/Component.ets#L26-L31 | 052d50dd7f30e9083efec77661942b77fdeeedab | gitee |
guyu0327/HarmonyGomoku.git | e615d8f24e08db68c23f0345cde1ff621de4cb07 | entry/src/main/ets/pages/Second.ets | arkts | drawChess | 绘制棋子 | drawChess(x: number, y: number) {
// 判断点击区域是否在棋盘内
if (x >= this.board_x && x <= this.board_x + this.board_width && y >= this.board_y &&
y <= this.board_y + this.board_width) {
// 判断并设置棋子颜色
if (this.chess_color) {
this.context.fillStyle = '#000';
} else {
this.context.fil... | AST#method_declaration#Left drawChess AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type... | drawChess(x: number, y: number) {
if (x >= this.board_x && x <= this.board_x + this.board_width && y >= this.board_y &&
y <= this.board_y + this.board_width) {
if (this.chess_color) {
this.context.fillStyle = '#000';
} else {
this.context.fillStyle = '#FFF';
}
... | https://github.com/guyu0327/HarmonyGomoku.git/blob/e615d8f24e08db68c23f0345cde1ff621de4cb07/entry/src/main/ets/pages/Second.ets#L97-L138 | 381c718e1d97bf3356fd94473200256592cf0d3e | github |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/utils/HttpUtil.ets | arkts | delete | @description: delete请求函数
@param {string} url 请求地址
@param {Object} data 请求参数
@param {RequestConfig} OtherConfig request其他配置
@return {*} | public delete<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> {
return this.request<T>(url, { method: http.RequestMethod.DELETE, extraData: data })
} | AST#method_declaration#Left public delete AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Righ... | public delete<T>(url: string, data?: Object): Promise<MyAwesomeData<T>> {
return this.request<T>(url, { method: http.RequestMethod.DELETE, extraData: data })
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/HttpUtil.ets#L128-L130 | 7eba26d6a3e6d7f27d74cf1cf9393b41939c51a0 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/navigation/NetworkRequestNav.ets | arkts | NetworkRequestNav | @file 通用网络请求示例页导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function NetworkRequestNav(): void {
NetworkRequestPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function NetworkRequestNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_cus... | @Builder
export function NetworkRequestNav(): void {
NetworkRequestPage();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/navigation/NetworkRequestNav.ets#L8-L11 | 3b516c4502711a5286e846a7a7d1ee169872272c | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/TEUtility.ets | arkts | getFavoriteStarTextString | 获取收藏星级字符串 | static getFavoriteStarTextString(favoriteLevel: number): string {
return "★".repeat(favoriteLevel);
} | AST#method_declaration#Left static getFavoriteStarTextString AST#parameter_list#Left ( AST#parameter#Left favoriteLevel : 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... | static getFavoriteStarTextString(favoriteLevel: number): string {
return "★".repeat(favoriteLevel);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/TEUtility.ets#L15-L17 | 1d9edac812bcd76e7fd36c61942004936d0f893a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets | arkts | registerDataChangeListener | 为LazyForEach组件向其数据源处添加listener监听
@param {DataChangeListener} listener - 监听对象 | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
console.info('add listener');
this.listeners.push(listener);
}
} | AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef... | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
console.info('add listener');
this.listeners.push(listener);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L73-L78 | e5986fdebed0397635b34b96743dca1f22cecc49 | gitee |
supermanaaaa/HarmonyOS-Next-Knowledge-Base.git | a818e59f200ebf4cae00bc634a6c04b9486b8a8f | HarmonyOSNextKnowledgeLearning/DevEco Studio/Design and Implementation of Active Image Caching Based on HarmonyOS 5 Ability Image Component/ImageReloadComponent.ets | arkts | getCacheFiles | 获取缓存文件夹中的所有文件列表 | public abstract getCacheFiles(): string[]; | AST#method_declaration#Left public abstract getCacheFiles AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | public abstract getCacheFiles(): string[]; | https://github.com/supermanaaaa/HarmonyOS-Next-Knowledge-Base.git/blob/a818e59f200ebf4cae00bc634a6c04b9486b8a8f/HarmonyOSNextKnowledgeLearning/DevEco Studio/Design and Implementation of Active Image Caching Based on HarmonyOS 5 Ability Image Component/ImageReloadComponent.ets#L107-L107 | f91690ca80b2473b08b3dc887072e2902b049c3a | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/WindowUtil.ets | arkts | TODO 窗口工具
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class WindowUtil {
/**
* 设置窗口的显示方向属性,使用Promise异步回调。
* Orientation 窗口显示方向类型枚举:
* UNSPECIFIED 0 表示未定义方向模式,由系统判定。
* PORTRAIT 1 表示竖屏显示模式。
* LANDSCAPE 2 表示横屏显示模式。
* PORTRAIT_INVERTED 3 表示反向竖屏显示模式。
* LANDSCAPE_INVERTED 4 表示反向横屏显示模式。
* AUTO_ROTATION 5 表示传感器自动旋转模式。
... | AST#export_declaration#Left export AST#class_declaration#Left class WindowUtil AST#class_body#Left { /**
* 设置窗口的显示方向属性,使用Promise异步回调。
* Orientation 窗口显示方向类型枚举:
* UNSPECIFIED 0 表示未定义方向模式,由系统判定。
* PORTRAIT 1 表示竖屏显示模式。
* LANDSCAPE 2 表示横屏显示模式。
* PORTRAIT_INVERTED 3 表示反向竖屏显示模式。
* LANDS... | export class WindowUtil {
static async setPreferredOrientation(orientation: window.Orientation,
windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> {
return windowClass.setPreferredOrientation(orientation);
}
static getPreferredOrientation(windowClass: window.Window = AppUtil.get... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/WindowUtil.ets#L26-L458 | b9ae8f0850930e57b1aa433ad557a08623ab6cf1 | gitee | |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets | arkts | removeSelectedItems | 移除选中的商品 | async removeSelectedItems(): Promise<void> {
const selectedItems = this.datas.filter((item: Type1): boolean => item.selected);
// 收集所有需要删除的 image_key
const imageKeysToDelete: string[] = [];
for (const item of selectedItems) {
const index = this.datas.indexOf(item);
if (index !== -1 && this... | AST#method_declaration#Left async removeSelectedItems 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#t... | async removeSelectedItems(): Promise<void> {
const selectedItems = this.datas.filter((item: Type1): boolean => item.selected);
const imageKeysToDelete: string[] = [];
for (const item of selectedItems) {
const index = this.datas.indexOf(item);
if (index !== -1 && this.cartItems[index]) {
... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L282-L307 | 81c2ad4eac4df7a4ff48638340c24a8c4da3324e | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getUnitsSectionedByPart | 获取按分类分段的单元数据 | getUnitsSectionedByPart(partId: number): SectionDatas<string, Unit> {
const sectionedDatas = new SectionDatas<string, Unit>();
if (partId === SearchConstants.PART_ID_ALL) {
this.parts.forEach(part => {
if (part.aliveUnits.length > 0) {
sectionedDatas.addSectionWithDatas(part.partName, p... | AST#method_declaration#Left getUnitsSectionedByPart AST#parameter_list#Left ( AST#parameter#Left partId : 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_typ... | getUnitsSectionedByPart(partId: number): SectionDatas<string, Unit> {
const sectionedDatas = new SectionDatas<string, Unit>();
if (partId === SearchConstants.PART_ID_ALL) {
this.parts.forEach(part => {
if (part.aliveUnits.length > 0) {
sectionedDatas.addSectionWithDatas(part.partName, p... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L494-L511 | 00bae63520277e274315f626bf78ea807bb78361 | github |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/common/utils/DeleteFile.ets | arkts | 函数1:删除文件
@param filename 文件名
@returns 是否删除成功 | export function deleteFile(filename: string): boolean {
try {
if (!_filesDir) {
console.error('DeleteUtils未初始化');
return false;
}
if (!filename || filename.trim() === '') {
console.error('文件名为空');
return false;
}
const filePath = `${_filesDir}/${filename}`;
// 检查文件是否... | AST#export_declaration#Left export AST#function_declaration#Left function deleteFile AST#parameter_list#Left ( AST#parameter#Left filename : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AS... | export function deleteFile(filename: string): boolean {
try {
if (!_filesDir) {
console.error('DeleteUtils未初始化');
return false;
}
if (!filename || filename.trim() === '') {
console.error('文件名为空');
return false;
}
const filePath = `${_filesDir}/${filename}`;
if (... | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/DeleteFile.ets#L35-L64 | a0672b3fb3bc05f66ed2374a71a257b8d76407bd | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/utils/DateHelper.ets | arkts | hasHour | 是否含有时 | static hasHour(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Hms || type == DateType.Hm;
} | AST#method_declaration#Left static hasHour AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | static hasHour(type: DateType): boolean {
return type == DateType.YmdHms || type == DateType.YmdHm
|| type == DateType.YmdH || type == DateType.Hms || type == DateType.Hm;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L70-L73 | d092df523a44d00ce9a13411ca79b402982987eb | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | aboutToAppear | 页面生命周期 - 即将出现 | aboutToAppear() {
// 获取路由参数
const params = appRouter.getCurrentParams();
this.contactId = params['contactId'] as string;
if (this.contactId) {
this.loadContactDetail();
} else {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Contact ID not found');
appRouter.back(... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 获取路由参数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST... | aboutToAppear() {
const params = appRouter.getCurrentParams();
this.contactId = params['contactId'] as string;
if (this.contactId) {
this.loadContactDetail();
} else {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Contact ID not found');
appRouter.back();
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L36-L47 | d9f84a2725cf3e9300c4206defc5d6d58f83185b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.