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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/database/rdb/ColumnInfo.ets | arkts | Copyright (C), 2024-06-22
@author LinXun
@date 2024-06-22 10:08
@version 1.0
@description: 数据库列接口 | export interface ColumnInfo{
// 实体属性名
name: string
// 数据库列名
columnName: string
// 列类型
type: ColumnType
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ColumnInfo AST#object_type#Left { // 实体属性名 AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right // 数据库列名 AST#type_member#Left columnName : AST#t... | export interface ColumnInfo{
name: string
columnName: string
type: ColumnType
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/database/rdb/ColumnInfo.ets#L8-L15 | b8c9cb58d6038b84f3a3202fcce4fb6d1332d65f | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/keyAgree/ECDH.ets | arkts | @Author csx
@DateTime 2024/3/20 20:21
@TODO ECDH 动态协商共享密钥
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto | export class ECDH {
/**
* ecdh动态协商密钥,要求密钥长度为256位的非对称密钥
* @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
* @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
* @returns ECC256共享密钥
*/
static async ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<string> {
r... | AST#export_declaration#Left export AST#class_declaration#Left class ECDH AST#class_body#Left { /**
* ecdh动态协商密钥,要求密钥长度为256位的非对称密钥
* @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】
* @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】
* @returns ECC256共享密钥
*/ AST#method_declaration#Left s... | export class ECDH {
static async ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<string> {
return DynamicUtil.dynamicKey(pubKey, priKey, 'ECC256',256);
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/keyAgree/ECDH.ets#L26-L36 | 3054a6490a8b2f46e266c66e79996fe09c10c0ba | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets | arkts | setAttachment | 应用约束:显式返回类型(错误45) | setAttachment(file: Object, name: string): Attachment {
this.file = { attachment: file, name: name };
return this;
} | AST#method_declaration#Left setAttachment AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | setAttachment(file: Object, name: string): Attachment {
this.file = { attachment: file, name: name };
return this;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets#L30-L33 | 550aeae0c952caeda5705ed5aea9ae5c0739c847 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | buildSearchSuggestions | 构建搜索建议 | @Builder
buildSearchSuggestions() {
Scroll() {
Column({ space: 24 }) {
// 搜索历史
if (this.searchHistory.length > 0) {
this.buildSearchHistorySection()
}
// 热门搜索
this.buildHotSearchSection()
}
.padding(16)
}
.layoutWeight(1)
.sc... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#ar... | @Builder
buildSearchSuggestions() {
Scroll() {
Column({ space: 24 }) {
if (this.searchHistory.length > 0) {
this.buildSearchHistorySection()
}
this.buildHotSearchSection()
}
.padding(16)
}
.layoutWeight(1)
.scrollBar(BarSta... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L304-L320 | 6a6a82fe5bef5431d1a8e92e29f372d64b444935 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | Implements watcher event listening.
@typedef { function } WatchEventListener
@param { WatchEvent } event - Event type for the callback to invoke.
@syscap SystemCapability.FileManagement.File.FileIO
@since 20 | export type WatchEventListener = (event: WatchEvent) => void; | AST#export_declaration#Left export AST#type_declaration#Left type WatchEventListener = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left WatchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST... | export type WatchEventListener = (event: WatchEvent) => void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4167-L4167 | dc601af289f695a9762777b6de65d64358832b51 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/data/TitleDataSource.ets | arkts | 标题懒加载类 | export class TitleDataSource implements IDataSource {
private dataArray: string[] = [];
private listeners: DataChangeListener[] = [];
totalCount(): number {
return this.dataArray.length;
}
getData(index: number): string {
return this.dataArray[index];
}
public addItem(title: string): void {
... | AST#export_declaration#Left export AST#class_declaration#Left class TitleDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#arra... | export class TitleDataSource implements IDataSource {
private dataArray: string[] = [];
private listeners: DataChangeListener[] = [];
totalCount(): number {
return this.dataArray.length;
}
getData(index: number): string {
return this.dataArray[index];
}
public addItem(title: string): void {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/data/TitleDataSource.ets#L17-L52 | 2afa7618788e4591185f8755f36a7493a5a7116c | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/ui2abc/libarkts/plugins/input/variable.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export const X: number = 1.2345; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left X : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1.2345 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right ... | export const X: number = 1.2345; | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/ui2abc/libarkts/plugins/input/variable.ets#L16-L16 | 917030169ac4c4dd1855eb26e717c93768a9fceb | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | getTempDirPath | 获取临时目录下的文件夹路径或文件路径。
@param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录
@param fileName 文件名(test.text);fileName传空字符串表示文件夹路径
@param blHap true:HAP级别文件路径、 false:App级别文件路径
@returns | static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().tempDir : getContext().getApplicationContext().tempDir; //根目录
if (Helper.isNotEmpty(dirPath)) {
if (Helper.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。
filePath = dir... | AST#method_declaration#Left static getTempDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annot... | static getTempDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string {
let filePath = blHap ? getContext().tempDir : getContext().getApplicationContext().tempDir;
if (Helper.isNotEmpty(dirPath)) {
if (Helper.hasDirPath(dirPath)) {
filePath = dirPath;
} else {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L218-L234 | a08d57149fd0a6c0615021656241a7d2b27973ea | gitee |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | ‘80%’ | export const THOUSANDTH_830: string = '83%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_830 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '83%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declar... | export const THOUSANDTH_830: string = '83%'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L59-L59 | e5ec853b219b6c852ee85e065d18d013d35b9a91 | github | |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/pages/EntryPage.ets | arkts | aboutToAppear | 页面即将显示时执行的生命周期函数 | aboutToAppear() {
this.onAccountsChange()
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onAccountsChange AST#m... | aboutToAppear() {
this.onAccountsChange()
} | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/pages/EntryPage.ets#L71-L73 | e4dda027787c406d9bf57df9081bbc900820c808 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/result/src/main/ets/RequestHelper.ets | arkts | toast | 配置是否自动 toast 错误
@param {boolean} enable - 是否展示
@returns {RequestHelper<T>} 当前实例 | toast(enable: boolean = true): RequestHelper<T> {
this.useToast = enable;
return this;
} | AST#method_declaration#Left toast AST#parameter_list#Left ( AST#parameter#Left enable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) AST#par... | toast(enable: boolean = true): RequestHelper<T> {
this.useToast = enable;
return this;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L78-L81 | 137292384588257255a6080a9fecbcfecb1ce7bc | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/llm/LLMService.ets | arkts | configure | 配置LLM服务 | configure(config: LLMConfig): void {
this.config = config;
this.status.configured = true;
this.status.errorCount = 0;
} | AST#method_declaration#Left configure AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left LLMConfig 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#Righ... | configure(config: LLMConfig): void {
this.config = config;
this.status.configured = true;
this.status.errorCount = 0;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L292-L296 | b83befafc63dd57c6cf6739ce70569e50fbd3a07 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | createDefaultUserGameData | 创建默认用户游戏数据 | private async createDefaultUserGameData(): Promise<UserGameData> {
return {
userId: 'default',
totalPoints: 0,
availablePoints: 0,
level: this.levelConfig[0],
experience: 0,
achievements: await this.initializeAchievements(),
dailyTasks: [],
streaks: new Map(),
s... | AST#method_declaration#Left private async createDefaultUserGameData 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 UserGameData AST#primary_type#Right AST#type_an... | private async createDefaultUserGameData(): Promise<UserGameData> {
return {
userId: 'default',
totalPoints: 0,
availablePoints: 0,
level: this.levelConfig[0],
experience: 0,
achievements: await this.initializeAchievements(),
dailyTasks: [],
streaks: new Map(),
s... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L548-L581 | 5443d3278995b1bd85856726a48535ae12dfbeb3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextReaderHelper.ets | arkts | queryReadState | 查询文章播报状态。
@param id 文章的id
@returns | static queryReadState(id: string): TextReader.ReadState {
try {
let readState = TextReader.queryReadState(id);
return readState;
} catch (e) {
console.error(`TextReader failed to queryReadState. Code: ${e.code}, message: ${e.message}`);
let readState: TextReader.ReadState = { id: id, sta... | AST#method_declaration#Left static queryReadState AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Le... | static queryReadState(id: string): TextReader.ReadState {
try {
let readState = TextReader.queryReadState(id);
return readState;
} catch (e) {
console.error(`TextReader failed to queryReadState. Code: ${e.code}, message: ${e.message}`);
let readState: TextReader.ReadState = { id: id, sta... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L178-L187 | 3e2797fa8334dfd9b583fe7afe459447e4338b2f | gitee |
wuyuanwuhui999/harmony-arkts-movie-app-ui.git | d5e9bebe1dca2759cba417d2b6b402941d3bc273 | entry/src/main/ets/pages/MoviePlayPage.ets | arkts | commentBuilder | @author: wuwenqiang
@description: 创建评论
@date: 2024-05-25 16:30 | @Builder commentBuilder() {
CommentComponent({commentListStr:'' ,relationId: this.movieItem.id, type: SocialEnum.MOVIE.toString() })
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right commentBuilder 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 CommentComponent ( AST#component_parameters#Left { AST#comp... | @Builder commentBuilder() {
CommentComponent({commentListStr:'' ,relationId: this.movieItem.id, type: SocialEnum.MOVIE.toString() })
} | https://github.com/wuyuanwuhui999/harmony-arkts-movie-app-ui.git/blob/d5e9bebe1dca2759cba417d2b6b402941d3bc273/entry/src/main/ets/pages/MoviePlayPage.ets#L80-L82 | 25fa315f4aaeed8efd68ef57b8e0c2474aa1b768 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/constraint.ets | arkts | 2025-01-05 14 | export const DATE_FORMAT4: string = "yyyy-MM-dd"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT4 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "yyyy-MM-dd" AST#expression#Right AST#variable_declarator#Right ; AST#variable_d... | export const DATE_FORMAT4: string = "yyyy-MM-dd"; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L10-L10 | 7e4c16cd7d05f1d1b1003df8c83b16292da1b8e1 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets | arkts | isToggle | 查询图片是否需要切换图片
@param offset -- 当前偏移量
@param winSize -- 视口大小
@param imageSize -- 图片大小
@param scale -- 缩放
@param TogglePercent -- 移动视口多少时候需要切换图片 | function isToggle(offset: number, winSize: number, imageSize: number, scale: number, TogglePercent: number): boolean {
let maxAllowedOffset = getMaxAllowedOffset(winSize, imageSize, scale);
const deviation = Math.abs(offset) - maxAllowedOffset;
const switchThreshold = winSize * TogglePercent;
if (deviation > s... | AST#function_declaration#Left function isToggle AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left winSize : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | function isToggle(offset: number, winSize: number, imageSize: number, scale: number, TogglePercent: number): boolean {
let maxAllowedOffset = getMaxAllowedOffset(winSize, imageSize, scale);
const deviation = Math.abs(offset) - maxAllowedOffset;
const switchThreshold = winSize * TogglePercent;
if (deviation > s... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets#L93-L102 | 4aa9a3a5772fce2b30d8eb5450d12ed87da38284 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | isDashedLineEnabled | Returns true if the dashed-line effect is enabled, false if not. Default:
disabled
@return | public isDashedLineEnabled(): boolean {
return this.mDashPathEffect == null ? false : true;
} | AST#method_declaration#Left public isDashedLineEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#con... | public isDashedLineEnabled(): boolean {
return this.mDashPathEffect == null ? false : true;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L131-L133 | 78889c61d2c1cb5af21bc88baf0bf6a02d36e54b | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | getYValuePosition | @Override | public getYValuePosition(): ValuePosition {
return this.mYValuePosition;
} | AST#method_declaration#Left public getYValuePosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ValuePosition AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST... | public getYValuePosition(): ValuePosition {
return this.mYValuePosition;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L152-L154 | a65da9e4c0000f40430ec3d5f0b4c648e188f8b1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/mainpage/MainPage.ets | arkts | IconMainColorComponent | 功能描述:本示例将介绍如何根据图片设置自适应的背景色。
推荐场景:list列表项需要高亮区分时使用
核心组件:
1.IconItem
实现步骤:
1.将模拟数据放入列表中
2.遍历模拟数据
3.将模拟数据中的icon图标转换为PixelMap
4.遍历PixelMap,将所有的像素放到一个数组中
5.遍历数组,找出出现次数最多的像素
6.将像素转换为RGB颜色格式
7.将RGB颜色格式转换为HSV颜色格式
8.调整HSV颜色格式中的参数
9.将HSV颜色格式转换为RGB格式
10.将RGB颜色格式转换为数字,放入模拟数据中
11.在ListItem组件中,设置子组件的背景色 | @Component
export struct IconMainColorComponent {
// 模拟数据列表
arrayAppInfo: Array<AppInfo> = [];
aboutToAppear(): void {
// 添加模拟数据
this.mockData();
// 遍历模拟数据,找出每个图标的主颜色,并设置为背景色
this.arrayAppInfo.forEach(async (item: AppInfo) => {
// 图片转换为PixelMap对象
const pixelMap: image.PixelMap = await... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct IconMainColorComponent AST#component_body#Left { // 模拟数据列表 AST#property_declaration#Left arrayAppInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_ann... | @Component
export struct IconMainColorComponent {
arrayAppInfo: Array<AppInfo> = [];
aboutToAppear(): void {
this.mockData();
this.arrayAppInfo.forEach(async (item: AppInfo) => {
const pixelMap: image.PixelMap = await image2PixelMap(item.icon);
const allPixels: number... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/mainpage/MainPage.ets#L42-L101 | f9829a8e75f46192b7cc7e8d3203ddf1546fc1b1 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets | arkts | init | 初始化会话 | public async init(): Promise<void> {
if (this.initialized) {
console.info('UserSession: 会话已初始化,无需重复操作');
return;
}
try {
console.info('UserSession: 开始初始化会话');
// 使用AppContext获取上下文
const context = AppContext.getContext();
console.info('UserSession: AppContext.getCo... | AST#method_declaration#Left public async init AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu... | public async init(): Promise<void> {
if (this.initialized) {
console.info('UserSession: 会话已初始化,无需重复操作');
return;
}
try {
console.info('UserSession: 开始初始化会话');
const context = AppContext.getContext();
console.info('UserSession: AppContext.getContext()返回:', context... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets#L73-L139 | 36e7cf18360964b46b7a7c26c6bfb9d67da4847b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Window/MediaFullScreen/entry/src/main/ets/pages/MediaFullScreen.ets | arkts | onBackPress | TODO:知识点:返回时进行判断,如果在非全屏状态则返回首页,否则仅退出全屏 | onBackPress(): boolean | void {
if (this.selectedVideo !== '') {
this.maskShow = false;
this.isLandscape = !this.isLandscape;
return true;
}
return false;
} | AST#method_declaration#Left onBackPress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left void AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#builder_function_body#Le... | onBackPress(): boolean | void {
if (this.selectedVideo !== '') {
this.maskShow = false;
this.isLandscape = !this.isLandscape;
return true;
}
return false;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Window/MediaFullScreen/entry/src/main/ets/pages/MediaFullScreen.ets#L118-L125 | a2b283c8ee5f75f416fa287f0f0ed0fed5d1ed74 | gitee |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/utils/FullScreen.ets | arkts | disable | 退出全屏 | async disable() {
try {
const ctx = AppStorage.get<Context>('context')
// 空安全
if (ctx) {
const winObj = await window.getLastWindow(ctx) // 上层窗口对象
// 打开全屏
winObj.setWindowLayoutFullScreen(false) // 异步操作
// logger.info('FullScreen封装', '完成')
AppStorage.setOr... | AST#method_declaration#Left async disable AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ctx = AST#expression#Left AST#call_expres... | async disable() {
try {
const ctx = AppStorage.get<Context>('context')
if (ctx) {
const winObj = await window.getLastWindow(ctx)
winObj.setWindowLayoutFullScreen(false)
AppStorage.setOrCreate('topHeight', 0)
AppStorage.setOrCreate('bottomHei... | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/FullScreen.ets#L45-L65 | 9fc3755b34eed17b5d39dd0e2128dff00aafa947 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/theme/ThemeManager.ets | arkts | setTheme | 设置主题 | async setTheme(theme: ThemeMode): Promise<void> {
try {
this.currentTheme = theme;
await StorageManager.setString(this.THEME_KEY, theme);
EventBus.emit('THEME_CHANGED', { theme });
Logger.info('ThemeManager', `Theme changed to: ${theme}`);
} catch (error) {
Logger.error('ThemeManag... | AST#method_declaration#Left async setTheme AST#parameter_list#Left ( AST#parameter#Left theme : AST#type_annotation#Left AST#primary_type#Left ThemeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async setTheme(theme: ThemeMode): Promise<void> {
try {
this.currentTheme = theme;
await StorageManager.setString(this.THEME_KEY, theme);
EventBus.emit('THEME_CHANGED', { theme });
Logger.info('ThemeManager', `Theme changed to: ${theme}`);
} catch (error) {
Logger.error('ThemeManag... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/theme/ThemeManager.ets#L82-L91 | 882a6af171332823da2217f0a0e022ed0af28615 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | buildType | 构建类型 | static buildType(): string {
return deviceInfo.buildType
} | AST#method_declaration#Left static buildType 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#member_express... | static buildType(): string {
return deviceInfo.buildType
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L188-L190 | c344363fe7a195cde597665f732e1bf4a9898253 | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+Menu.ets | arkts | getMenuButtonBoundingClientRect | 界面 / 菜单 / wx.getMenuButtonBoundingClientRect https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html | getMenuButtonBoundingClientRect(data: DMPMap, callback: DMPBridgeCallback) {
const whData = DMPDeviceUtil.getSafeAreaAndDisplayWHSync()
const width = 87;
const height = 32;
const top = whData.get('statusBarHeight') as number;
const right = whData.get('windowWidth') - 10;
const left = right - wi... | AST#method_declaration#Left getMenuButtonBoundingClientRect AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left DMPMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left DMPBri... | getMenuButtonBoundingClientRect(data: DMPMap, callback: DMPBridgeCallback) {
const whData = DMPDeviceUtil.getSafeAreaAndDisplayWHSync()
const width = 87;
const height = 32;
const top = whData.get('statusBarHeight') as number;
const right = whData.get('windowWidth') - 10;
const left = right - wi... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+Menu.ets#L15-L34 | 3ab7a821b7960c575cf2b566342958d8f478a715 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets | arkts | 代表自定义类
@class
@property {string} desc - 视频名称描述
@property {string} author - 作者名称
@property {string} including - 包含内容 | export class VideoDataType {
desc: string = '';
author: string = '';
constructor(desc: string, author: string) {
this.desc = desc;
this.author = author;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class VideoDataType AST#class_body#Left { AST#property_declaration#Left desc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Rig... | export class VideoDataType {
desc: string = '';
author: string = '';
constructor(desc: string, author: string) {
this.desc = desc;
this.author = author;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L24-L32 | 6b77ae071fe1ee9e4e5eead3e5ecc808e0ef6581 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/FoldableAdaptation/entry/src/main/ets/pages/FullScreenPage.ets | arkts | FullScreenPage | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct FullScreenPage {
private imageSrc: ResourceStr = '';
build() {
Column() {
Text($r('app.string.full_screen_page'))
Image(this.imageSrc)
.width($r('app.string.size_percent_100'))
}.height($r('app.string.size_percent_100'))
.width($r('app.string.size_percent_10... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FullScreenPage AST#component_body#Left { AST#property_declaration#Left private imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Le... | @Component
export struct FullScreenPage {
private imageSrc: ResourceStr = '';
build() {
Column() {
Text($r('app.string.full_screen_page'))
Image(this.imageSrc)
.width($r('app.string.size_percent_100'))
}.height($r('app.string.size_percent_100'))
.width($r('app.string.size_percent_10... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/FoldableAdaptation/entry/src/main/ets/pages/FullScreenPage.ets#L16-L28 | e5f198f81c2f7e5a357810012cb327f4ff3668e2 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets | arkts | addItem | 在指定索引位置增加一个元素 | public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray.length);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig... | public addItem(index: number): void {
this.dataArray.splice(index, 0, this.dataArray.length);
this.notifyDataAdd(index);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L107-L110 | 6e82066ace759e0365f0a425855478a6de5846a2 | gitee |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Validation.ets | arkts | assuming you have a corresponding module for CurlyArg | export abstract class ValidationResult {
static resultValid(hint?: string | number, ...args: CurlyArg[]): ValidationResult {
if (typeof hint === 'number') {
return new Valid({ hintMessageId: hint, args });
} else if (typeof hint === 'string') {
return new Valid({ hintMessageStr: hint, args });
... | AST#export_declaration#Left export AST#class_declaration#Left abstract class ValidationResult AST#class_body#Left { AST#method_declaration#Left static resultValid AST#parameter_list#Left ( AST#parameter#Left hint ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#... | export abstract class ValidationResult {
static resultValid(hint?: string | number, ...args: CurlyArg[]): ValidationResult {
if (typeof hint === 'number') {
return new Valid({ hintMessageId: hint, args });
} else if (typeof hint === 'string') {
return new Valid({ hintMessageStr: hint, args });
... | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Validation.ets#L6-L29 | 7a37f441551e99f292e70035f7afe90cfbb6a4f2 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/CombinedChartModel.ets | arkts | getBubbleData | @Override | public getBubbleData(): BubbleData | null {
if (this.mData == null)
return null;
return this.mData.getBubbleData();
} | AST#method_declaration#Left public getBubbleData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BubbleData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statem... | public getBubbleData(): BubbleData | null {
if (this.mData == null)
return null;
return this.mData.getBubbleData();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L161-L165 | ddadd2dd4dfb5893a8a1e457e05c5e17b1a0a157 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationContentUtil.ets | arkts | initBasicNotificationContent | init basic notification content
@param basicContent
@return return the created NotificationContent | initBasicNotificationContent(basicContent: notificationManager.NotificationBasicContent): notificationManager.NotificationContent {
return {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // 通知内容类型
normal: basicContent // 基本类型通知内容
};
} | AST#method_declaration#Left initBasicNotificationContent AST#parameter_list#Left ( AST#parameter#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationBasicContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#paramet... | initBasicNotificationContent(basicContent: notificationManager.NotificationBasicContent): notificationManager.NotificationContent {
return {
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: basicContent
};
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationContentUtil.ets#L27-L32 | e29aa14ef98de8cd07dacb8a9d0fbc067f3ed1f6 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets | arkts | toggleSpecSelection | 切换规格选中状态 | toggleSpecSelection(goodsId: number, specId: number) {
if (!this.selectedItems.has(goodsId)) {
this.selectedItems.set(goodsId, new Set());
}
const specs = this.selectedItems.get(goodsId)!;
if (specs.has(specId)) {
specs.delete(specId);
} else {
specs.add(specId);
}
this.cal... | AST#method_declaration#Left toggleSpecSelection AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primar... | toggleSpecSelection(goodsId: number, specId: number) {
if (!this.selectedItems.has(goodsId)) {
this.selectedItems.set(goodsId, new Set());
}
const specs = this.selectedItems.get(goodsId)!;
if (specs.has(specId)) {
specs.delete(specId);
} else {
specs.add(specId);
}
this.cal... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L276-L288 | 4d661f8d72e1b7f19fd3b3ae9c3549e160176328 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ApplicationModels/MissionManager/entry/src/main/ets/common/TitleBar.ets | arkts | TitleBar | Copyright (c) 2020 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct TitleBar {
build() {
Row() {
Text($r('app.string.title'))
.width('82%')
.fontColor(Color.White)
.fontSize(26)
}
.height('8%')
.width('100%')
.constraintSize({ minHeight: 70 })
.backgroundColor('#0D9FFB')
.padding({ left: 16, right: 16 ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST... | @Component
export struct TitleBar {
build() {
Row() {
Text($r('app.string.title'))
.width('82%')
.fontColor(Color.White)
.fontSize(26)
}
.height('8%')
.width('100%')
.constraintSize({ minHeight: 70 })
.backgroundColor('#0D9FFB')
.padding({ left: 16, right: 16 ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/MissionManager/entry/src/main/ets/common/TitleBar.ets#L16-L31 | 62914954ceee93c26c92fd1fa66b91623b0ae70d | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/field_sensitive/container/map_field_sensitive_002_F.ets | arkts | Introduction Map域敏感 | export function map_field_sensitive_002_F(taint_src : string) {
let map = new Map<string,string>();
map.set("key1", taint_src)
map.set("key2", "clean")
taint.Sink(map.get("key2")!);
} | AST#export_declaration#Left export AST#function_declaration#Left function map_field_sensitive_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_sta... | export function map_field_sensitive_002_F(taint_src : string) {
let map = new Map<string,string>();
map.set("key1", taint_src)
map.set("key2", "clean")
taint.Sink(map.get("key2")!);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/map_field_sensitive_002_F.ets#L6-L11 | 39f5b4d206091edc8f012c572f721f1e6b4cd847 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | insertSampleCommemorations | 插入示例纪念日数据 | private async insertSampleCommemorations(): Promise<void> {
try {
const sampleCommemorations: CommemorationEntity[] = [
{
contact_id: 1, // 张小红
title: '生日',
commemoration_date: '1995-03-15',
type: '生日',
is_lunar: false,
reminder_enabled: true... | AST#method_declaration#Left private async insertSampleCommemorations 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_annotatio... | private async insertSampleCommemorations(): Promise<void> {
try {
const sampleCommemorations: CommemorationEntity[] = [
{
contact_id: 1,
title: '生日',
commemoration_date: '1995-03-15',
type: '生日',
is_lunar: false,
reminder_enabled: true,
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L529-L614 | e1e5e16da467ef3ba39971016f660b24b0ab5ce6 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/lottie/LottieView.ets | arkts | getDuration | 获取动画单次完整播放的时间(与播放速度无关)或帧数, 与Lottie.loadAnimation接口入参initialSegment有关
@param inFrames 值为true时获取帧数, 值为false时获取时间(单位ms)
@since 8
@design | getDuration(inFrames?: boolean): number | undefined {
return this.animationItem?.getDuration(inFrames)
} | AST#method_declaration#Left getDuration AST#parameter_list#Left ( AST#parameter#Left inFrames ? : 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#union_type#Left AST#primary_type#Left nu... | getDuration(inFrames?: boolean): number | undefined {
return this.animationItem?.getDuration(inFrames)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L290-L292 | 146d42b1fadb99752a5a0a894379fc31a5c23794 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/observe/InputObserved.ets | arkts | 接口定义 | export interface IInputObserved extends IObservedData {
text: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IInputObserved AST#extends_clause#Left extends IObservedData AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#... | export interface IInputObserved extends IObservedData {
text: string
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/observe/InputObserved.ets#L18-L20 | 6c094527006485eccba6e5aacc50cd2f4834e3b1 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | setDataText | 将纯文本数据写入系统剪贴板,使用Promise异步回调。
@param text 纯文本数据
@returns | static async setDataText(text: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
} | AST#method_declaration#Left static async setDataText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type... | static async setDataText(text: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L110-L112 | 536ce02125bf4decee60ea6dc3f0d45359689162 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | isToday | 判断日期是否是今天 | static isToday(date: number | string | Date) {
let today = DateUtils.getTodayStr(DATE_FORMAT4);
let day = DateUtils.getFormatDateStr(date, DATE_FORMAT4)
return today === day;
} | AST#method_declaration#Left static isToday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right A... | static isToday(date: number | string | Date) {
let today = DateUtils.getTodayStr(DATE_FORMAT4);
let day = DateUtils.getFormatDateStr(date, DATE_FORMAT4)
return today === day;
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L120-L124 | c23993f4ef2f013c426f97092fff9dad66568e2e | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets | arkts | createRdbStore | Create rdb store
@param {context} Context
@return {globalThis.rdbStore} return rdbStore RDB database | async createRdbStore(context: Context) {
if (!GlobalContext.getrdbStore()) {
// 获取RdbStore
await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG)
.then((rdbStore: DataRdb.RdbStore) => {
if (rdbStore) {
// 创建数据表
rdbStore.executeSql(CommonConstants.C... | AST#method_declaration#Left async createRdbStore AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_... | async createRdbStore(context: Context) {
if (!GlobalContext.getrdbStore()) {
await DataRdb.getRdbStore(context, CommonConstants.RDB_STORE_CONFIG)
.then((rdbStore: DataRdb.RdbStore) => {
if (rdbStore) {
rdbStore.executeSql(CommonConstants.CREATE_TABLE_ACCOUNT).... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets#L39-L58 | 6452a1a04b7c7fd96c6553365572f5f544a3b6cb | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/OrderRepository.ets | arkts | getUserOrderCount | 获取用户订单数量汇总
@returns 订单数量信息 | async getUserOrderCount(): Promise<NetworkResponse<OrderCount>> {
return this.networkDataSource.getUserOrderCount();
} | AST#method_declaration#Left async getUserOrderCount 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 getUserOrderCount(): Promise<NetworkResponse<OrderCount>> {
return this.networkDataSource.getUserOrderCount();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L91-L93 | 7ccea887473caf7f5bf4fb8dcb0a4582b12a387b | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets | arkts | this | 设置网格背景颜色 | this.model.setGridBackgroundColor('#500000ff'); | AST#method_declaration#Left this AST#ERROR#Left . model . set Grid BackgroundColor AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left '#500000ff' AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right | this.model.setGridBackgroundColor('#500000ff'); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets#L133-L133 | 5aa3f406940059213d4db64bfba7f6a912d0c7c9 | gitee |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/view/launcher/HeaderTitleBar.ets | arkts | HeaderTitleBar | export interface HeaderController { rightClick?: () => void } | @ComponentV2
export struct HeaderTitleBar{
@Param title: string = '标题'
@Param isShowRightText: boolean = false
@Param rightText: string = 'xxx'
@Event rightClick: () => void;
build() {
RelativeContainer(){
Image($r('app.media.icon_back'))
.width(60)
.height(60)
.margin({left:... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HeaderTitleBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann... | @ComponentV2
export struct HeaderTitleBar{
@Param title: string = '标题'
@Param isShowRightText: boolean = false
@Param rightText: string = 'xxx'
@Event rightClick: () => void;
build() {
RelativeContainer(){
Image($r('app.media.icon_back'))
.width(60)
.height(60)
.margin({left:... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/view/launcher/HeaderTitleBar.ets#L6-L62 | d79fb3f1f8c2885e595fe842a2b4967840413225 | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/PacketHeadWithLen/entry/src/main/ets/pages/Index.ets | arkts | test | 测试 | async test() {
//服务端地址
let serverAddress: socket.NetAddress = { address: this.serverIp, port: this.port, family: 1 }
//执行TCP通讯的对象
let tcpSocket: socket.TCPSocket = socket.constructTCPSocketInstance()
//收到消息时的处理
tcpSocket.on("message", (value: socket.SocketMessageInfo) => {
this.receiveMsgF... | AST#method_declaration#Left async test AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //服务端地址 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left serverAddress : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . NetAddress AST#... | async test() {
let serverAddress: socket.NetAddress = { address: this.serverIp, port: this.port, family: 1 }
let tcpSocket: socket.TCPSocket = socket.constructTCPSocketInstance()
tcpSocket.on("message", (value: socket.SocketMessageInfo) => {
this.receiveMsgFromServer(value)
})
... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/PacketHeadWithLen/entry/src/main/ets/pages/Index.ets#L93-L119 | 8e663fa87a5ebf43c0539a12a03df05c8bf122b8 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildSendButton | 构建发送按钮 | @Builder
buildSendButton() {
LoadingButton({
text: '发送祝福',
loadingText: '发送中...',
loading: this.sending,
disabled: !this.customContent.trim(),
backgroundColorStr: '#ff6b6b',
heightValue: 48,
onButtonClick: () => {
this.sendGreeting();
}
})
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSendButton 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 LoadingButton ( AST#component_parameters#Left { AST#compon... | @Builder
buildSendButton() {
LoadingButton({
text: '发送祝福',
loadingText: '发送中...',
loading: this.sending,
disabled: !this.customContent.trim(),
backgroundColorStr: '#ff6b6b',
heightValue: 48,
onButtonClick: () => {
this.sendGreeting();
}
})
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L587-L600 | 199ddab61dcda3bd03127afd7b4b582df8f180a4 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.matrix4.d.ets | arkts | Set poly to poly point.
@interface Point
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface Point {
/**
* Point x.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
x: number;
/**
* Point y.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | AST#export_declaration#Left export AST#interface_declaration#Left interface Point AST#object_type#Left { /**
* Point x.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left x : AST#type_annotation#L... | export interface Point {
x: number;
y: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.matrix4.d.ets#L498-L521 | 7f91a0d4c0a46cb071e131351d203b7604a5992a | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/StatusBarUtils.ets | arkts | getNavigationBarHeight | 获取底部导航条的高度,单位为px。
@returns | public static getNavigationBarHeight(): number {
let windowClass = AppUtils.getMainWindow()
let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
return avoidArea.bottomRect.height
} | AST#method_declaration#Left public static getNavigationBarHeight 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_decl... | public static getNavigationBarHeight(): number {
let windowClass = AppUtils.getMainWindow()
let avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
return avoidArea.bottomRect.height
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StatusBarUtils.ets#L54-L58 | 9f390fe7ba92ee2e306f905e508a054afa55ed09 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/wordcard/WordCardOne.ets | arkts | buildExampleTitlePronPanel | // 构建词性和分类图标行 @Builder buildWordAttributesRow() { Row(){ // 词性图标 Image(this.getWordKindIcon()) .width(19) .height(16) // 分类图标 Image(this.getCategoryIcon()) .width(40) .height(12) .margin({ left: 10, right: 20 }) } .width('100%') .justifyContent(FlexAlign.End) .margin({ top: 5 }) } 构建例句标题和语音按钮区域 | @Builder
buildExampleTitlePronPanel() {
Row(){
// 例句 标题
Text($r('app.string.wordcard_txt_example'))
.fontSize(22)
.fontColor($r('app.color.color_text'))
.textAlign(TextAlign.Start)
Blank().layoutWeight(1)
// 例句语音按钮
IconButton({ icon: $r('app.media.ic_lan... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildExampleTitlePronPanel 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 { // 例句... | @Builder
buildExampleTitlePronPanel() {
Row(){
Text($r('app.string.wordcard_txt_example'))
.fontSize(22)
.fontColor($r('app.color.color_text'))
.textAlign(TextAlign.Start)
Blank().layoutWeight(1)
IconButton({ icon: $r('app.media.ic_langdu_nroaml'), ico... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardOne.ets#L288-L305 | d8a1ddc3b38480d140d5cbfb693bc646a7cb357c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/searchcomponent/Index.ets | arkts | SearchComponent | 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 { SearchComponent } from './src/main/ets/components/mainpage/SearchComponent'; | AST#export_declaration#Left export { SearchComponent } from './src/main/ets/components/mainpage/SearchComponent' ; AST#export_declaration#Right | export { SearchComponent } from './src/main/ets/components/mainpage/SearchComponent'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchcomponent/Index.ets#L16-L16 | 6028abcb0e0be539b9e92440e344fb5e9af529e8 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/plug/EventBusPage.ets | arkts | EventBusPage | @nutpi/eventbus,使用案例 | @Entry
@ComponentV2
export struct EventBusPage {
private scroller: Scroller = new Scroller();
@Local describe: DescribeBean = router.getParams() as DescribeBean;
@Local txtStr: string = "";
build() {
Column() {
TitleBarView({ describe: this.describe })
Divider()
Scroll(this.scroller) {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct EventBusPage AST#component_body#Left { AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right A... | @Entry
@ComponentV2
export struct EventBusPage {
private scroller: Scroller = new Scroller();
@Local describe: DescribeBean = router.getParams() as DescribeBean;
@Local txtStr: string = "";
build() {
Column() {
TitleBarView({ describe: this.describe })
Divider()
Scroll(this.scroller) {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/plug/EventBusPage.ets#L11-L113 | 9f46d93ebbb8f0a045063e0f5849f4fafcd01345 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/NetworkDemoPage.ets | arkts | NetworkDemoPage | @file Network Demo 示例页视图
@author Joker.X | @ComponentV2
export struct NetworkDemoPage {
/**
* Network Demo 示例页 ViewModel
*/
@Local
private vm: NetworkDemoViewModel = new NetworkDemoViewModel();
/**
* 构建 Network Demo 示例页
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: $r("app.string.demo_base_network_title"),
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct NetworkDemoPage AST#component_body#Left { /**
* Network Demo 示例页 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type... | @ComponentV2
export struct NetworkDemoPage {
@Local
private vm: NetworkDemoViewModel = new NetworkDemoViewModel();
build() {
AppNavDestination({
title: $r("app.string.demo_base_network_title"),
viewModel: this.vm
}) {
BaseNetWorkView({
uiState: this.vm.uiState,
onR... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkDemoPage.ets#L9-L45 | b9737045e6ded632add50281ec37fdacc6690ea4 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/cs/CustomerServiceNetworkDataSourceImpl.ets | arkts | getMessagePage | 分页获取消息
@param {MessagePageRequest} params - 分页参数
@returns {Promise<NetworkResponse<NetworkPageData<CsMsg>>>} 消息分页数据 | async getMessagePage(params: MessagePageRequest): Promise<NetworkResponse<NetworkPageData<CsMsg>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<CsMsg>>> =
await NetworkClient.http.post("cs/msg/page", params);
return resp.data;
} | AST#method_declaration#Left async getMessagePage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left MessagePageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge... | async getMessagePage(params: MessagePageRequest): Promise<NetworkResponse<NetworkPageData<CsMsg>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<CsMsg>>> =
await NetworkClient.http.post("cs/msg/page", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/cs/CustomerServiceNetworkDataSourceImpl.ets#L47-L51 | 17a145faa2379756fa8a7079ee7e609cb717a96e | github |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/AppState.ets | arkts | 导出单例 | export const appState = AppState.getInstance(); | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left appState = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#... | export const appState = AppState.getInstance(); | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/AppState.ets#L197-L197 | 6aa69ee6ca766fa49465aa047d750ad13a8b8b02 | github | |
junw2024/hnchain-ArkTs.git | 0cc3c182ad418709b577fa24e9fe909a205232c6 | entry/src/main/ets/common/utils/http/HttpProtocol.ets | arkts | Supported protocols.
支持的协议
@since 9 | export enum HttpProtocol {
HTTP1_1,
HTTP2
} | AST#export_declaration#Left export AST#enum_declaration#Left enum HttpProtocol AST#enum_body#Left { AST#enum_member#Left HTTP1_1 AST#enum_member#Right , AST#enum_member#Left HTTP2 AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right | export enum HttpProtocol {
HTTP1_1,
HTTP2
} | https://github.com/junw2024/hnchain-ArkTs.git/blob/0cc3c182ad418709b577fa24e9fe909a205232c6/entry/src/main/ets/common/utils/http/HttpProtocol.ets#L6-L9 | 230a813418b7b805a92b3b63ef40907e3c735754 | github | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/common/StudyTimeManager.ets | arkts | formatStudyTime | 格式化学习时长显示 | static formatStudyTime(minutes: number): string {
if (minutes >= 1000 * 60 * 24) { // 超过1000小时(转换为天)
const days = Math.floor(minutes / (60 * 24))
return `${days}天`
} else if (minutes >= 1000) { // 超过1000分钟(转换为小时)
const hours = Math.floor(minutes / 60)
const remainingMinutes = minutes % 6... | AST#method_declaration#Left static formatStudyTime AST#parameter_list#Left ( AST#parameter#Left minutes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | static formatStudyTime(minutes: number): string {
if (minutes >= 1000 * 60 * 24) {
const days = Math.floor(minutes / (60 * 24))
return `${days}天`
} else if (minutes >= 1000) {
const hours = Math.floor(minutes / 60)
const remainingMinutes = minutes % 60
if (remainingMinutes === 0)... | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/StudyTimeManager.ets#L123-L138 | f2edb9c1efe498feea138f691ac3380cf69233d4 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/login_register/login.ets | arkts | showSystemPrivacyDialog | 新增方法:显示系统对话框 | showSystemPrivacyDialog() {
try {
this.promptAction.showDialog({
title: '隐私政策',
message: '隐私保护政策\n' +
'\n' +
'1.为了便于您了解您在使用我们的服务时,我们需要收集的信息类型与用途,我们将结合具体服务向您逐一说明。\n' +
'\n' +
'2.为完成创建账号,您需提供手机号码,用于账号免密登录或短信验证注册。用户注册完成后,会默认使用您的手机号码作为的用户名。如果不同意,将无法完成注册', //... | AST#method_declaration#Left showSystemPrivacyDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left A... | showSystemPrivacyDialog() {
try {
this.promptAction.showDialog({
title: '隐私政策',
message: '隐私保护政策\n' +
'\n' +
'1.为了便于您了解您在使用我们的服务时,我们需要收集的信息类型与用途,我们将结合具体服务向您逐一说明。\n' +
'\n' +
'2.为完成创建账号,您需提供手机号码,用于账号免密登录或短信验证注册。用户注册完成后,会默认使用您的手机号码作为的用户名。如果不同意,将无法完成注册',
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/login_register/login.ets#L147-L180 | f617e13ac52dbb5bcb3fe1b850fdb2dfa09b6c15 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/LoginPage.ets | arkts | startCountDown | 倒计时开始函数 | startCountDown(){
if (this.isCountingDown){
// 重复提交时弹出
promptAction.showToast({
message:'提交过于频繁',
duration: 2000,
})
return
}
//准备开始阶段,把倒计时开关打开
this.isCountingDown = true
this.Countdown = 60;
//开始倒计时
this.intervalID = setInterval(() => {
if (this... | AST#method_declaration#Left startCountDown 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 . isCountingDown AST#member_expression#Right AST#expressio... | startCountDown(){
if (this.isCountingDown){
promptAction.showToast({
message:'提交过于频繁',
duration: 2000,
})
return
}
this.isCountingDown = true
this.Countdown = 60;
this.intervalID = setInterval(() => {
if (this.Countdown > 0) {
this.Cou... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/LoginPage/LoginPage.ets#L30-L62 | 6e44b29e4722e9e1548e61bf16b79c893a548fe3 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | @Author csx
@DateTime 2024/8/14 23:40
@TODO efRcpConfig efRcp配置对象命名空间 本类灵感来源于官方rcp.xxxxxxx
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_rcp | export namespace efRcpConfig {
/**
* 超时对象
*/
export class timeout {
/**
* 允许建立连接的最长时间
*/
connectMs?: number;
/**
* 允许传输数据的最长时间
*/
transferMs?: number;
} | AST#export_declaration#Left export AST#ERROR#Left namespace efRcpConfig { /**
* 超时对象
*/ export AST#ERROR#Right AST#class_declaration#Left class timeout AST#class_body#Left { /**
* 允许建立连接的最长时间
*/ AST#property_declaration#Left connectMs ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | export namespace efRcpConfig {
export class timeout {
connectMs?: number;
transferMs?: number;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L26-L40 | 110f5d69e374ec7d379d83fb0f12311b82e520b2 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | deleteDreamItem | 删除当前梦想 | private deleteDreamItem() {
if (!this.dream.id) {
console.error('无法删除梦想:梦想ID不存在');
const toastOpts: ToastOptions = { message: '无法删除梦想' };
promptAction.showToast(toastOpts);
return;
}
promptAction_1.showDialog({
title: '确认删除',
message: '确定要删除这个梦想吗?删除后将无法恢复。',
button... | AST#method_declaration#Left private deleteDreamItem 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! ... | private deleteDreamItem() {
if (!this.dream.id) {
console.error('无法删除梦想:梦想ID不存在');
const toastOpts: ToastOptions = { message: '无法删除梦想' };
promptAction.showToast(toastOpts);
return;
}
promptAction_1.showDialog({
title: '确认删除',
message: '确定要删除这个梦想吗?删除后将无法恢复。',
button... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L874-L922 | dfbd4c0f8ebc84abbaaee91ec555ce26839eea25 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets | arkts | CubeSwiperController 类用于管理立方体轮播组件的数据。
提供了添加、删除、推送和设置数据的方法。 | export class CubeSwiperController {
/**
* 在指定索引位置插入一个新数据项。
* @param index - 插入新数据项的位置索引。
* @param data - 要插入的数据对象。
*/
addData: (index: number, data: ESObject) => void = () => {};
/**
* 删除指定索引位置的数据项。
* @param index - 要删除的数据项的位置索引。
*/
deleteData: (index: number) => void = () => {};
/**
... | AST#export_declaration#Left export AST#class_declaration#Left class CubeSwiperController AST#class_body#Left { /**
* 在指定索引位置插入一个新数据项。
* @param index - 插入新数据项的位置索引。
* @param data - 要插入的数据对象。
*/ AST#property_declaration#Left addData : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( A... | export class CubeSwiperController {
addData: (index: number, data: ESObject) => void = () => {};
deleteData: (index: number) => void = () => {};
updateData: (index: number, data: ESObject) => void = () => {};
pushData: (data: ESObject) => void = () => {};
setData: (data: ESObject[]) => voi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets#L20-L53 | 6b06400c521faff96968c25aac6122dcb0d327c7 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 纪念日提醒配置接口 | export interface AnniversaryReminderConfig {
enabled: boolean;
advanceDays: number[];
reminderTime: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AnniversaryReminderConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left advanceDays : A... | export interface AnniversaryReminderConfig {
enabled: boolean;
advanceDays: number[];
reminderTime: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L76-L80 | b193952cea331c4b69ce558060c4745bab303843 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWarmPlayerView.ets | arkts | onCastPlayDeviceConnected | 已连接的投屏设备。
@param state. 0 设备已准备好可以播放。1:设备已断开 | onCastPlayDeviceConnected(device: VHCastPickerDevice){
this.castPickDevice = device.deviceName;
} | AST#method_declaration#Left onCastPlayDeviceConnected AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left VHCastPickerDevice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_st... | onCastPlayDeviceConnected(device: VHCastPickerDevice){
this.castPickDevice = device.deviceName;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L236-L238 | 1a2ed039164bcd9db7d9b7de0142b0af8d93a86c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/common/CommonConstant.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export enum ComponentId {
NORMAL_RESULT_ID = 'normalReqResult',
STREAM_RESULT_ID = 'streamReqResult',
HTTP_BUTTON = 'HttpButton',
STREAM_HTTP_BUTTON = 'StreamHttpButton',
HTTP_TITLE = 'HttpTitleId'
}; | AST#export_declaration#Left export AST#enum_declaration#Left enum ComponentId AST#enum_body#Left { AST#enum_member#Left NORMAL_RESULT_ID = AST#expression#Left 'normalReqResult' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left STREAM_RESULT_ID = AST#expression#Left 'streamReqResult' AST#expression#Right... | export enum ComponentId {
NORMAL_RESULT_ID = 'normalReqResult',
STREAM_RESULT_ID = 'streamReqResult',
HTTP_BUTTON = 'HttpButton',
STREAM_HTTP_BUTTON = 'StreamHttpButton',
HTTP_TITLE = 'HttpTitleId'
}; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/common/CommonConstant.ets#L16-L22 | ade57d54b1441fcb11300fbb357c2bd18b80787d | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Scroll.ets | arkts | 构建带大内边距的垂直滚动布局
@returns {void} 无返回值 | build(): void {
VerticalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_large"),
... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left VerticalScroll ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expr... | build(): void {
VerticalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_large"),
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Scroll.ets#L275-L286 | 4712b0ac4461936a1028671677ba6eaa78fa1144 | github | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/field_sensitive/container/array_004_F.ets | arkts | Introduction 数组索引 | export function array_004_F(taint_src : string) {
let arr = [[taint_src], ["b"], "c"]
taint.Sink(arr[1][0]);
} | AST#export_declaration#Left export AST#function_declaration#Left function array_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ... | export function array_004_F(taint_src : string) {
let arr = [[taint_src], ["b"], "c"]
taint.Sink(arr[1][0]);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/array_004_F.ets#L6-L9 | af9c278df8bee376a3ce6405ab93a41fde3edda5 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getWordsByUnitId | 根据单元ID获取单词 | getWordsByUnitId(unitId: number): WordUser[] {
const unit = this.getUnitById(unitId);
return unit ? unit.aliveWords : [];
} | AST#method_declaration#Left getWordsByUnitId AST#parameter_list#Left ( AST#parameter#Left unitId : 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#array_type#Left Wo... | getWordsByUnitId(unitId: number): WordUser[] {
const unit = this.getUnitById(unitId);
return unit ? unit.aliveWords : [];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L436-L439 | fbb68afdc57222142b1659e7b029fba88e7f8251 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entryability/EntryAbility.ets | arkts | [End EventSub_Capi_Header] | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
// [Start AppEvent_ArkTS_Add_Watcher]
// 添加按钮事件观察者
hiAppEvent.addWatcher({
// 开发者可以自定义观察者名称,系统会使用名称来标识不同的观... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#ty... | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hiAppEvent.addWatcher({
name: 'appEventWatcher',
appEventFilters: [{
domain:... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/PerformanceAnalysisKit/HiAppEvent/EventSub/entry/src/main/ets/entryability/EntryAbility.ets#L25-L353 | 2c7d0e247b216a42ca4ddf6a173c136373502d62 | gitee | |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSMultiPicture/commons/base/src/main/ets/constants/BreakpointConstants.ets | arkts | 设备类型常量 | export class BreakpointConstants {
/**
* 小设备
*/
static readonly BREAKPOINT_SM: string = 'sm';
/**
* 中设备
*/
static readonly BREAKPOINT_MD: string = 'md';
/**
* 大设备
*/
static readonly BREAKPOINT_LG: string = 'lg';
/**
* 屏幕宽度范围
*/
static readonly BREAKPOINT_SCOPE: number[] = [0, 320... | AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /**
* 小设备
*/ AST#property_declaration#Left static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sm'... | export class BreakpointConstants {
static readonly BREAKPOINT_SM: string = 'sm';
static readonly BREAKPOINT_MD: string = 'md';
static readonly BREAKPOINT_LG: string = 'lg';
static readonly BREAKPOINT_SCOPE: number[] = [0, 320, 600, 840];
} | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPicture/commons/base/src/main/ets/constants/BreakpointConstants.ets#L4-L21 | 387247c46825dc068b4b708e8fcaf14930478dae | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets | arkts | getFpsJitterScore | 方法描述 计算kpi抖动率的得分(y=100*EXP(-0.458*x))
@param param param
@return java.lang.Integer 得分 | private static getFpsJitterScore(param: number): number {
if (null == param) {
return null;
}
return Math.round(100.0 * Math.exp(-0.458 * 100 * param));
} | AST#method_declaration#Left private static getFpsJitterScore AST#parameter_list#Left ( AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number ... | private static getFpsJitterScore(param: number): number {
if (null == param) {
return null;
}
return Math.round(100.0 * Math.exp(-0.458 * 100 * param));
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets#L122-L127 | 20c77e976ec26734ab50611fdc2557e609b55098 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/model/AboutLinkItem.ets | arkts | @file 关于页面链接数据模型
@author Joker.X | export interface AboutLinkItem {
/**
* 标题
*/
title: Resource;
/**
* 链接地址
*/
url: Resource;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AboutLinkItem AST#object_type#Left { /**
* 标题
*/ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 链接地址
*/ AST#type_me... | export interface AboutLinkItem {
title: Resource;
url: Resource;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/model/AboutLinkItem.ets#L5-L14 | 7d127e22fde961cf01b6deb5f557bf3e936936d9 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/marquee/src/main/ets/view/Marquee.ets | arkts | MarqueeViewComponent | 功能描述: 本示例介绍了文本宽度过宽时,如何实现文本首尾相接循环滚动并显示在可视区,以及每循环滚动一次之后会停滞一段时间后再滚动。
推荐场景: 消息通知展示
核心组件:
1. MarqueeSection - 跑马灯组件
实现步骤:
1. 跑马灯内容视图。开发者可以根据自身业务场景设置文本的属性(字体大小、字体颜色、字体粗细等属性)
@example
@Builder
marqueeTextBuilder(marqueeText: ResourceStr) {
Text(marqueeText)
}
2. 构建跑马灯视图。在代码合适的位置使用MarqueeSection组件并传入对应的参数。
@example
Marque... | @Component
export struct MarqueeViewComponent {
build() {
Column() {
// 场景介绍组件
FunctionDescription({
title: $r('app.string.marquee_title'),
content: $r('app.string.marquee_content')
})
// 行程信息组件
TripView()
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MarqueeViewComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_... | @Component
export struct MarqueeViewComponent {
build() {
Column() {
FunctionDescription({
title: $r('app.string.marquee_title'),
content: $r('app.string.marquee_content')
})
TripView()
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.wid... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/view/Marquee.ets#L86-L107 | 706d4181b00703e0c55b9161ba5ba307484911fc | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/timer/TimerDialog.ets | arkts | stopTimer | 暂停计时 | private stopTimer() {
if (this.timerId !== -1) {
clearInterval(this.timerId);
this.timerId = -1;
}
this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时已暂停";
this.statusPromptColor=Color.Orange;
this.isRunning = false;
this.isPaused = true; // 标记为暂停状态
} | AST#method_declaration#Left private stopTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression... | private stopTimer() {
if (this.timerId !== -1) {
clearInterval(this.timerId);
this.timerId = -1;
}
this.statusPrompt = this.totalSeconds + '秒 ' + "倒计时已暂停";
this.statusPromptColor=Color.Orange;
this.isRunning = false;
this.isPaused = true;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L124-L133 | c6e02abb63cf8b3619a8960e865f85ce3105b80c | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/booksUtils.ets | arkts | partialUpdate | 更新部分书籍信息 | async partialUpdate(books: Books){
BooksDao.partialUpdate(books)
} | AST#method_declaration#Left async partialUpdate AST#parameter_list#Left ( AST#parameter#Left books : AST#type_annotation#Left AST#primary_type#Left Books AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#exp... | async partialUpdate(books: Books){
BooksDao.partialUpdate(books)
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/booksUtils.ets#L29-L31 | 8f0d131315438413aa7c0018adb1b1804c6fd9d1 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/DynamicUtil.ets | arkts | @Author csx
@DateTime 2024/3/20 21:19
@TODO DynamicUtil 动态协商工具类 | export class DynamicUtil {
/**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @returns 共享密钥
*/
static async dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string,
keyName: num... | AST#export_declaration#Left export AST#class_declaration#Left class DynamicUtil AST#class_body#Left { /**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @returns 共享密钥
*/ AST#method_declaration#Left static async dynami... | export class DynamicUtil {
static async dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string,
keyName: number): Promise<string> {
let pubKeyArray: Uint8Array = new Uint8Array();
let priKeyArray: Uint8Array = new Uint8Array();
if (typeof pubKey === '... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/DynamicUtil.ets#L28-L98 | 45e461bd154c1bfbcb4ac5e284ea397c130c0f63 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | 应用创建时调用
初始化应用上下文、设置颜色模式、注册路由
@param {Want} want - 启动意图
@param {AbilityConstant.LaunchParam} launchParam - 启动参数
@returns {void} 无返回值 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
this.registerRouter();
ContextUtil.init(this.context)
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed... | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
this.registerRouter();
ContextUtil.init(this.context)
} catch (err) {
hilog.error(DOMAIN, 'testTag', 'Failed... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/entryability/EntryAbility.ets#L27-L36 | 650f4e8571cc7e07fea36728afb8c7c2d2474203 | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/viewmodel/AlarmItem.ets | arkts | 闹钟项描述。 | @Observed export default class AlarmItem extends ReminderItem {
/**
* 闹钟名称。
*/
name = '闹钟';
/**
* 闹钟是否启用。
*/
isOpen: boolean = true;
/**
* 闹钟重复类型。
*/
repeatType: RepeatType = RepeatType.NoRepeat;
/**
* 闹钟持续时间。
*/
duration: number = 5;
/**
* 闹钟间隔时间(分钟)。
*/
intervalMi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export default AST#class_declaration#Left class AlarmItem extends AST#type_annotation#Left AST#primary_type#Left ReminderItem AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 闹钟名称。
*/ AST#property_d... | @Observed export default class AlarmItem extends ReminderItem {
name = '闹钟';
isOpen: boolean = true;
repeatType: RepeatType = RepeatType.NoRepeat;
duration: number = 5;
intervalMinute: number = 10;
intervalTimes: number = 3;
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/viewmodel/AlarmItem.ets#L6-L36 | 7f1f86e7ef97fa6e9e3a655685a74628e0cb81d2 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WindowUtil.ets | arkts | findWindow | 查找name所对应的窗口。
@param name 窗口名字,即Configuration中的name。
@returns | static findWindow(name: string): window.Window | undefined {
try {
return window.findWindow(name);
} catch (e) {
const err = e as BusinessError;
LogUtil.error(`findWindow - code:${err.code},message:${err.message}`);
}
return undefined;
} | AST#method_declaration#Left static findWindow AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST... | static findWindow(name: string): window.Window | undefined {
try {
return window.findWindow(name);
} catch (e) {
const err = e as BusinessError;
LogUtil.error(`findWindow - code:${err.code},message:${err.message}`);
}
return undefined;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L515-L523 | b80f693b4d8a255a25dee178cdcc812f428732f2 | gitee |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/model/UserModel.ets | arkts | fromJson | 从JSON对象创建UserInfo实例 | static fromJson(json: UserJsonData): UserInfo {
return new UserInfo(
json.id,
json.username,
json.password
);
} | AST#method_declaration#Left static fromJson AST#parameter_list#Left ( AST#parameter#Left json : AST#type_annotation#Left AST#primary_type#Left UserJsonData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primar... | static fromJson(json: UserJsonData): UserInfo {
return new UserInfo(
json.id,
json.username,
json.password
);
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L69-L75 | e7dae06ac8aaf3000fd5a0712466cb0f9d3aeb77 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/EnterpriseAdminExtensionAbility/EnterpriseAdminExtensionAbility/entry/src/main/ets/utils/CommonEventValue.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 class CommonEventValue {
public static EVENT_DISABLE_WIFI = 'event_disable_wifi';
public static EVENT_ENABLE_WIFI = 'event_enable_wifi';
public static EVENT_QUERY_WIFI_STATUS = 'event_query_wifi_status';
public static EVENT_DISABLE_ADMIN = 'event_disable_admin';
public static EVENT_REBOOT = 'event... | AST#export_declaration#Left export AST#class_declaration#Left class CommonEventValue AST#class_body#Left { AST#property_declaration#Left public static EVENT_DISABLE_WIFI = AST#expression#Left 'event_disable_wifi' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public static EVENT_ENA... | export class CommonEventValue {
public static EVENT_DISABLE_WIFI = 'event_disable_wifi';
public static EVENT_ENABLE_WIFI = 'event_enable_wifi';
public static EVENT_QUERY_WIFI_STATUS = 'event_query_wifi_status';
public static EVENT_DISABLE_ADMIN = 'event_disable_admin';
public static EVENT_REBOOT = 'event... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/EnterpriseAdminExtensionAbility/EnterpriseAdminExtensionAbility/entry/src/main/ets/utils/CommonEventValue.ets#L16-L35 | e60dc51b3a65d3374ed8b3e64079878e7f76d733 | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Notification/CustomNotificationBadge/entry/src/main/ets/components/TitleBar.ets | arkts | TitleBar | Page title bar | @Component
export struct TitleBar {
private title: string | Resource | undefined = undefined
build() {
Row() {
Text(this.title)
.fontSize(24)
.fontWeight(700)
.lineHeight(32)
.margin({ left: 24 })
.fontColor('#182431')
}
.width('100%')
.height(70)
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#pr... | @Component
export struct TitleBar {
private title: string | Resource | undefined = undefined
build() {
Row() {
Text(this.title)
.fontSize(24)
.fontWeight(700)
.lineHeight(32)
.margin({ left: 24 })
.fontColor('#182431')
}
.width('100%')
.height(70)
.... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Notification/CustomNotificationBadge/entry/src/main/ets/components/TitleBar.ets#L18-L35 | 1e9c34d51edbaf6860241cba25bbb51bcde369c9 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | $_instantiate | Set the value.
TapGestureParameters: The parameters of the tapGesture.
@param { function } factory
@param { TapGestureParameters } value
@returns { TapGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | static $_instantiate(factory: () => TapGesture, value?: TapGestureParameters): TapGesture; | AST#method_declaration#Left static $_instantiate AST#parameter_list#Left ( AST#parameter#Left factory : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left TapGesture AST#primary_type#Right AST#type_annotation#Right AST#f... | static $_instantiate(factory: () => TapGesture, value?: TapGestureParameters): TapGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L377-L377 | 47c8c501ec58334cd54522cd31eb91423ded24b8 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | removeData | 删除数据函数 | removeData(index: number): void {
this.originDataArray = this.originDataArray.slice(index, 1);
} | AST#method_declaration#Left removeData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right A... | removeData(index: number): void {
this.originDataArray = this.originDataArray.slice(index, 1);
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L40-L42 | f00a889332b54a00bc4070e5aa32635b8c07104e | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/SystemCheckService.ets | arkts | 系统检查服务类 | export class SystemCheckService {
/**
* 检查文件系统
*/
static async checkFileSystem(): Promise<CheckResult> {
try {
console.info('[SystemCheckService] 开始检查文件系统');
const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_FS);
console.info('[SystemCheckService] 文件系统检查响应:', JSON.stri... | AST#export_declaration#Left export AST#class_declaration#Left class SystemCheckService AST#class_body#Left { /**
* 检查文件系统
*/ AST#method_declaration#Left static async checkFileSystem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise ... | export class SystemCheckService {
static async checkFileSystem(): Promise<CheckResult> {
try {
console.info('[SystemCheckService] 开始检查文件系统');
const response = await HttpUtil.get(AppConstants.API.SYSTEM_CHECK_FS);
console.info('[SystemCheckService] 文件系统检查响应:', JSON.stringify(response));
... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L21-L136 | 54b84a092923f9cc24221c8c0ac3a20b4e9d1bb9 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | goStatistics | 跳转到统计页面 | async goStatistics(): Promise<void> {
await this.push(RoutePaths.STATISTICS);
} | AST#method_declaration#Left async goStatistics AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | async goStatistics(): Promise<void> {
await this.push(RoutePaths.STATISTICS);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L328-L330 | 7b8cb97d7f984fd43222311810bce0332f548fe6 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets | arkts | aboutToAppear | 分型控制器 | aboutToAppear(): void {
if (!fileIo.accessSync(this.shareTempDirPath)) {
// 不存在则创建
fileIo.mkdirSync(this.shareTempDirPath);
}
Promise.all([getPixelFromResource(this.ctx, $r('app.media.lighthouse')), createBarcode(this.url, 400)])
.then(async (result) => {
this.imagePath = this.sha... | 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expre... | aboutToAppear(): void {
if (!fileIo.accessSync(this.shareTempDirPath)) {
fileIo.mkdirSync(this.shareTempDirPath);
}
Promise.all([getPixelFromResource(this.ctx, $r('app.media.lighthouse')), createBarcode(this.url, 400)])
.then(async (result) => {
this.imagePath = this.shareTempDir... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets#L68-L85 | 828170224de5c7c1e67bb4c924850c82c946ba23 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | 颜色主题接口 | export interface ColorTheme {
id: string;
name: string;
description: string;
preview: string;
colors: {
primary: string;
primaryVariant: string;
secondary: string;
secondaryVariant: string;
surface: string;
background: string;
error: string;
onPrimary: string;
onSecondary: ... | AST#export_declaration#Left export AST#interface_declaration#Left interface ColorTheme AST#ERROR#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 name : AST#type_annotation#Left AST#primar... | export interface ColorTheme {
id: string;
name: string;
description: string;
preview: string;
colors: {
primary: string;
primaryVariant: string;
secondary: string;
secondaryVariant: string;
surface: string;
background: string;
error: string;
onPrimary: string;
onSecondary: ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L49-L67 | 015aeddd5d7dcc7f0933622f10385e059a9504c3 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsInfoCard.ets | arkts | 构建商品信息卡片视图
@returns {void} 无返回值 | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
Card({
widthValue: P100,
paddingValue: $r("app.float.space_padding_medium")
}) {
... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width... | build(): void {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
}
}) {
Card({
widthValue: P100,
paddingValue: $r("app.float.space_padding_medium")
}) {
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsInfoCard.ets#L52-L108 | fbfe23d35c00427555db802cb355690c4b80d791 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/DeviceCertificateKit/CertificateAlgorithmLibrary/entry/src/main/ets/pages/CreateParseVerifyCertObject.ets | arkts | certSample | 证书示例 | function certSample(): void {
let textEncoder = new util.TextEncoder();
let encodingBlob: cert.EncodingBlob = {
// 将证书数据从string类型转换成Unit8Array
data: textEncoder.encodeInto(certData),
// 证书格式,仅支持PEM和DER。在此示例中,证书为PEM格式
encodingFormat: cert.EncodingFormat.FORMAT_PEM
};
// 创建X509Cert实例
cert.creat... | AST#function_declaration#Left function certSample AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textE... | function certSample(): void {
let textEncoder = new util.TextEncoder();
let encodingBlob: cert.EncodingBlob = {
data: textEncoder.encodeInto(certData),
encodingFormat: cert.EncodingFormat.FORMAT_PEM
};
cert.createX509Cert(encodingBlob, (err, x509Cert) => {
if (err != null) {
失败
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/DeviceCertificateKit/CertificateAlgorithmLibrary/entry/src/main/ets/pages/CreateParseVerifyCertObject.ets#L34-L87 | e996b363cee929a9536d3ecd9309b26c2c5764ad | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/MediaService/src/main/ets/controller/AvPlayerController.ets | arkts | setAvSessionListener | [Start listener1] | public async setAvSessionListener(): Promise<void> {
if (!this.avSessionController) {
return;
}
try {
this.avSessionController.getAvSession()?.on('play', () => this.sessionPlayCallback());
this.avSessionController.getAvSession()?.on('pause', () => this.sessionPauseCallback());
this.a... | AST#method_declaration#Left public async setAvSessionListener 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... | public async setAvSessionListener(): Promise<void> {
if (!this.avSessionController) {
return;
}
try {
this.avSessionController.getAvSession()?.on('play', () => this.sessionPlayCallback());
this.avSessionController.getAvSession()?.on('pause', () => this.sessionPauseCallback());
this.a... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvPlayerController.ets#L119-L134 | 0eccbfd8208924ac1237bd28dd80e607e30ff317 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | setMaxSelected | Set max select count to picker component, include max_total_count, max_photo_count and max_video_count.
@param { MaxSelected } maxSelected - max select count data
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | setMaxSelected(maxSelected: MaxSelected): void; | AST#method_declaration#Left setMaxSelected AST#parameter_list#Left ( AST#parameter#Left maxSelected : AST#type_annotation#Left AST#primary_type#Left MaxSelected AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima... | setMaxSelected(maxSelected: MaxSelected): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L268-L268 | 6ddce83dfb3a42b95078cf0b695b7fce823dc144 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/FileUtils.ets | arkts | getFileName | 通过URI或路径,获取文件名。
@param uriOrPath URI或路径
@returns | static getFileName(uriOrPath: string): string {
return FileUtils.getFileUri(uriOrPath).name;
} | AST#method_declaration#Left static getFileName AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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 string AST#primar... | static getFileName(uriOrPath: string): string {
return FileUtils.getFileUri(uriOrPath).name;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L184-L186 | 9219dd0c5bb854a5f8c476c83e6ba62159581c45 | gitee |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/event/ProgressEvent.ets | arkts | 假设存在 ProgressEventType 枚举类型 | export default class ProgressEvent {
private bytes: number;
private eventType: ProgressEventType;
constructor(eventType: ProgressEventType, bytes: number = 0) {
if (eventType === null) {
throw new Error("eventType must not be null.");
}
if (bytes < 0) {
throw new Error("bytes transferred... | AST#export_declaration#Left export default AST#class_declaration#Left class ProgressEvent AST#class_body#Left { AST#property_declaration#Left private bytes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#L... | export default class ProgressEvent {
private bytes: number;
private eventType: ProgressEventType;
constructor(eventType: ProgressEventType, bytes: number = 0) {
if (eventType === null) {
throw new Error("eventType must not be null.");
}
if (bytes < 0) {
throw new Error("bytes transferred... | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/event/ProgressEvent.ets#L3-L29 | e8001c51d7703b6578813cae313ffba30640a9a4 | github | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/notify/NotificationHelper.ets | arkts | cancelAll | 取消所有通知 | async cancelAll(): Promise<void> {
await notification.cancelAll().then(() => {
this.logInfo('cancelAll notification success');
});
} | AST#method_declaration#Left async cancelAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argume... | async cancelAll(): Promise<void> {
await notification.cancelAll().then(() => {
this.logInfo('cancelAll notification success');
});
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/notify/NotificationHelper.ets#L202-L206 | 9c7dc6f634d87cd518aaa07625a2427865b4bef7 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | 升级行为
@since 2022-06-10 | export enum UpdateAction {
/**
* 搜索新版本
*/
CHECK_NEW_VERSION,
/**
* 下载
*/
DOWNLOAD,
/**
* 取消升级
*/
CANCEL,
/**
* 继续下载
*/
RESUME,
/**
* 安装
*/
INSTALL,
/**
* 重启
*/
REBOOT,
/**
* 显示新版本页面
*/
SHOW_NEW_VERSION,
/**
* 显示进度圆圈
*/
SHOW_PROCESS_V... | AST#export_declaration#Left export AST#enum_declaration#Left enum UpdateAction AST#enum_body#Left { /**
* 搜索新版本
*/ AST#enum_member#Left CHECK_NEW_VERSION AST#enum_member#Right , /**
* 下载
*/ AST#enum_member#Left DOWNLOAD AST#enum_member#Right , /**
* 取消升级
*/ AST#enum_member#Left CANCEL AST#enum_member#... | export enum UpdateAction {
CHECK_NEW_VERSION,
DOWNLOAD,
CANCEL,
RESUME,
INSTALL,
REBOOT,
SHOW_NEW_VERSION,
SHOW_PROCESS_VIEW
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L148-L188 | 07d8e5154662d5fe4c3a0c12582183c82dc28b50 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | saveLocalMemoForWord | 保存单词的本地备忘录 | async saveLocalMemoForWord(word: WordUser, memo: string): Promise<void> {
word.memo = memo;
await WordUserDbAccess.shared.saveWordUser(word);
} | AST#method_declaration#Left async saveLocalMemoForWord AST#parameter_list#Left ( AST#parameter#Left word : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left memo : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | async saveLocalMemoForWord(word: WordUser, memo: string): Promise<void> {
word.memo = memo;
await WordUserDbAccess.shared.saveWordUser(word);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L861-L864 | 3441a3ed3972e991cc595f11b13c940b5dcdb7c4 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | 用户动作接口 | export interface UserAction {
id: string;
type: ActionType;
targetId: string; // 操作对象ID
timestamp: string;
duration?: number; // 操作持续时间
rating?: number; // 用户评分
context: Record<string, any>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserAction 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 type : AST#type_annotation#Left AST#... | export interface UserAction {
id: string;
type: ActionType;
targetId: string;
timestamp: string;
duration?: number;
rating?: number;
context: Record<string, any>;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/recommendation/RecommendationEngine.ets#L81-L89 | 7cc0722bcd558b6690694a54a0727edca0d71724 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/swiper/SwiperCustomAnimation.ets | arkts | SwiperCustomAnimation | [Start customize_transition_animations] | @Entry
@Component
export struct SwiperCustomAnimation {
private DISPLAY_COUNT: number = 2;
private MIN_SCALE: number = 0.75;
@State backgroundColors: Color[] = [Color.Green, Color.Blue, Color.Yellow, Color.Pink, Color.Gray, Color.Orange];
@State opacityList: number[] = [];
@State scaleList: number[] = [];
@... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct SwiperCustomAnimation AST#component_body#Left { AST#property_declaration#Left private DISPLAY_COUNT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | @Entry
@Component
export struct SwiperCustomAnimation {
private DISPLAY_COUNT: number = 2;
private MIN_SCALE: number = 0.75;
@State backgroundColors: Color[] = [Color.Green, Color.Blue, Color.Yellow, Color.Pink, Color.Gray, Color.Orange];
@State opacityList: number[] = [];
@State scaleList: number[] = [];
@... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/swiper/SwiperCustomAnimation.ets#L19-L103 | 3aada1a180a40e807fad2e93681dc5c632e7ee8e | gitee |
Wayne-007/iMusic.git | ab55f2e57ffe1c6e0a26589047b0187842dc9eb3 | entry/src/main/ets/pages/Play.ets | arkts | PlayBuilder | 跳转页面入口函数 | @Builder
export function PlayBuilder() {
Play()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PlayBuilder 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 Play ( ) AST#ui_component#Right AST#... | @Builder
export function PlayBuilder() {
Play()
} | https://github.com/Wayne-007/iMusic.git/blob/ab55f2e57ffe1c6e0a26589047b0187842dc9eb3/entry/src/main/ets/pages/Play.ets#L7-L10 | 616d2e754ccc5df88415f9830fe0670e40798665 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets | arkts | flushPage | 刷新图层显示 | flushPage(): void {
this.tempPixelMap = this.pixelMap;
this.pixelMap = null;
this.pixelMap = this.tempPixelMap;
} | AST#method_declaration#Left flushPage 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 AST#member_e... | flushPage(): void {
this.tempPixelMap = this.pixelMap;
this.pixelMap = null;
this.pixelMap = this.tempPixelMap;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/PictureOptions.ets#L78-L82 | b4a14a988187219aa795f3803e747d6c8843c9c0 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.