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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhToast.ets | arkts | showText | / 文字弹框 | public static showText(loadingText: ResourceStr) {
JhToast._showToast(loadingText, _ToastType.text)
} | AST#method_declaration#Left public static showText AST#parameter_list#Left ( AST#parameter#Left loadingText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme... | public static showText(loadingText: ResourceStr) {
JhToast._showToast(loadingText, _ToastType.text)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L39-L41 | 42b7254991805eaabb9af3686635bf4e7c8ee6db | github |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | getValueByAxis | 代理到 C++ 实例的 getValueByX 方法 | getValueByAxis(pos: number): number {
return this.instance.getValueByAxis(pos);
} | AST#method_declaration#Left getValueByAxis AST#parameter_list#Left ( AST#parameter#Left pos : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Rig... | getValueByAxis(pos: number): number {
return this.instance.getValueByAxis(pos);
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L208-L210 | 3f23e0fb00e26218878409c1d3735018115162c9 | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Bundle/Util/DMPFileUrlConvertor.ets | arkts | vPathFromLocalPath | 将本地路径转换为虚拟路径 | static vPathFromLocalPath(localPath: string): string {
if (localPath.startsWith('/')) {
const relativePath = localPath.replace(/^\//, DMPFileURLScheme);
return relativePath;
}
return localPath;
} | AST#method_declaration#Left static vPathFromLocalPath AST#parameter_list#Left ( AST#parameter#Left localPath : 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... | static vPathFromLocalPath(localPath: string): string {
if (localPath.startsWith('/')) {
const relativePath = localPath.replace(/^\
return relativePath;
}
return localPath;
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileUrlConvertor.ets#L32-L38 | b315bc68631bc39e9daff52f0ce5a73742a1cac8 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | loadCancelReasons | 加载取消原因字典数据
@returns {void} 无返回值 | loadCancelReasons(): void {
if (this.cancelReasonsUiState === BaseNetWorkUiState.SUCCESS && this.cancelReasonList.length > 0) {
return;
}
const params: DictDataRequest = new DictDataRequest();
params.types = ["orderCancelReason"];
RequestHelper.repository<DictDataResponse>(this.commonRepositor... | AST#method_declaration#Left loadCancelReasons 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Lef... | loadCancelReasons(): void {
if (this.cancelReasonsUiState === BaseNetWorkUiState.SUCCESS && this.cancelReasonList.length > 0) {
return;
}
const params: DictDataRequest = new DictDataRequest();
params.types = ["orderCancelReason"];
RequestHelper.repository<DictDataResponse>(this.commonRepositor... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L231-L251 | dda63c1bc5443f9d1c985ed1a37eba387a7f2b24 | github |
HarmonyCandies/pull_to_refresh.git | 9f65d4c122697a1baa955fd19371f965cb2a0700 | pull_to_refresh/src/main/ets/common/RefreshConstants.ets | arkts | / The signature for a function that's called when the user has dragged a / [PullToRefresh] far enough to demonstrate that they want the app to / refresh. The returned [Future] must complete when the refresh operation is / finished. / / Used by [PullToRefresh.onRefresh]. | export type RefreshCallback = ()=> Promise<boolean>; | AST#export_declaration#Left export AST#type_declaration#Left type RefreshCallback = AST#type_annotation#Left AST#function_type#Left 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#... | export type RefreshCallback = ()=> Promise<boolean>; | https://github.com/HarmonyCandies/pull_to_refresh.git/blob/9f65d4c122697a1baa955fd19371f965cb2a0700/pull_to_refresh/src/main/ets/common/RefreshConstants.ets#L22-L22 | 56d98e3a0596a77e6b06ea34cbba689d013c6510 | github | |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | pushData | 追加数据 | pushData(data: T): void {
this.dataSource.push(data);
this.notifyDataAdd(this.dataSource.length - 1);
} | AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T 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 AST#type_... | pushData(data: T): void {
this.dataSource.push(data);
this.notifyDataAdd(this.dataSource.length - 1);
} | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L41-L44 | aaa3c98c16111849842d647e70a221abafa9b1a4 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets | arkts | routerUri | 跳转页面 | async routerUri(name: string, path: string, fd: number, uri: string, isDlpFile: boolean, fileSuffix: string) {
router.pushUrl({
url: 'media/filePage',
params: {
fileName: name,
myPath: path,
fd: fd,
myUri: uri,
isDlpFile: isDlpFile,
fileSuffix: fileSuffix,... | AST#method_declaration#Left async routerUri 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#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri... | async routerUri(name: string, path: string, fd: number, uri: string, isDlpFile: boolean, fileSuffix: string) {
router.pushUrl({
url: 'media/filePage',
params: {
fileName: name,
myPath: path,
fd: fd,
myUri: uri,
isDlpFile: isDlpFile,
fileSuffix: fileSuffix,... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L375-L391 | 00d655dde78f04af7716cfc01e7611b4e5bcfb54 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/WantAgentUtil.ets | arkts | createWantAgentForStartAbility | create wantAgent for start ability
@param bundleName
@param abilityName
@return return the created WantAgent object. | async createWantAgentForStartAbility(bundleName: string, abilityName: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: bundleName,
abilityName: abilityName
}
],
operationType: wantAgent.OperationType.START_ABILITY,
requestCod... | AST#method_declaration#Left async createWantAgentForStartAbility AST#parameter_list#Left ( AST#parameter#Left bundleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left abilityName : AST#type_annotation#Left AST#primary_ty... | async createWantAgentForStartAbility(bundleName: string, abilityName: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: bundleName,
abilityName: abilityName
}
],
operationType: wantAgent.OperationType.START_ABILITY,
requestCod... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomNotification/notification/src/main/ets/notification/WantAgentUtil.ets#L27-L39 | 572fed4afe53a774593e63f72d15367764d3735f | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/SoundEffect/SEManager.ets | arkts | 全局播放函数 | export function playSE(type: SEType): void {
SEService.shared.playSound(type);
} | AST#export_declaration#Left export AST#function_declaration#Left function playSE AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left SEType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primar... | export function playSE(type: SEType): void {
SEService.shared.playSound(type);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L311-L313 | b48ba4ceda7ac324db4fefa56175fe134bc4af8d | github | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/action/ToastUtil.ets | arkts | initToastDefault | 初始化DialogOptions参数 | private static initToastDefault(options: ToastOptions, type: number): ToastOptions {
if (type == 1) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_short;
} else if (type == 2) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_long;
} else {
... | AST#method_declaration#Left private static initToastDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ToastOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left n... | private static initToastDefault(options: ToastOptions, type: number): ToastOptions {
if (type == 1) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_short;
} else if (type == 2) {
options.duration = options.duration ?? ToastUtil.defaultConfig.duration_long;
} else {
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/action/ToastUtil.ets#L88-L107 | 795e79eab7e05c55ce714d258526529b880bee19 | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/textInput/model/TextInputData.ets | arkts | TextInputData | 文本输入模型数据 | @ObservedV2
export class TextInputData {
/**
* 文本颜色
*/
@Trace color: string = TEXT_INPUT_DEFAULT_COLOR
/**
* 文本内容
*/
@Trace text: string | undefined
/**
* 施加在文本框整体的缩放参数,用于响应调整按钮调整尺寸,初始值为父节点缩放值的倒数
*/
@Trace scaleOpt: ScaleOptions = { x: 1, y: 1 }
/**
* 旋转角度
*/
@Trace angle: number... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class TextInputData AST#class_body#Left { /**
* 文本颜色
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right... | @ObservedV2
export class TextInputData {
@Trace color: string = TEXT_INPUT_DEFAULT_COLOR
@Trace text: string | undefined
@Trace scaleOpt: ScaleOptions = { x: 1, y: 1 }
@Trace angle: number = 0
@Trace transOpt: TranslateOptions = { x: 0, y: 0 }
@Trace activated: boolean = true
@Trace b... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/model/TextInputData.ets#L27-L151 | 105070e905e7731b726347e91547990b1d664818 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets | arkts | transform | TODO: 知识点: 新老版本字段转换逻辑(版本升级只需要实现这个方法即可)
@param resultSet 查询结果集
@param targetVersion 目标版本
@returns 目标版本格式数据 | abstract transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket; | AST#method_declaration#Left abstract transform AST#parameter_list#Left ( AST#parameter#Left resultSet : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ta... | abstract transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets#L83-L83 | 626067a1169a2d5f7043409b1a8122af91daf2aa | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/storage/StorageManager.ets | arkts | clearExpiredCache | 清理过期缓存(基于时间戳) | static async clearExpiredCache(expireDays: number = 7): Promise<void> {
try {
const expireTime = Date.now() - expireDays * 24 * 60 * 60 * 1000;
const keys = await StorageManager.getAllKeys();
let clearedCount = 0;
for (const key of keys) {
// 检查是否是时间戳键(以 _timestamp 结尾)
... | AST#method_declaration#Left static async clearExpiredCache AST#parameter_list#Left ( AST#parameter#Left expireDays : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 7 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty... | static async clearExpiredCache(expireDays: number = 7): Promise<void> {
try {
const expireTime = Date.now() - expireDays * 24 * 60 * 60 * 1000;
const keys = await StorageManager.getAllKeys();
let clearedCount = 0;
for (const key of keys) {
if (key.endsWith('_timestamp... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L245-L269 | 12ce840a116725d88c48ec84136d35c3e741ede7 | github |
htliang128/arkts_oss.git | 9da4a87c36272873c649f556854bd793ac337a18 | htliang_oss/src/main/ets/internal/model/WebServiceRequest.ets | arkts | getParameters | public setProgressListener(progressListener: ProgressListener): void { this.progressListener = progressListener ? progressListener : NOOP; } public getProgressListener(): ProgressListener { return this.progressListener; } public withProgressListener(progressListener: ProgressListener) { this.setProgressListener(progr... | public getParameters(): TreeMap<string, string> {
return this.parameters;
} | AST#method_declaration#Left public getParameters AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left TreeMap AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type... | public getParameters(): TreeMap<string, string> {
return this.parameters;
} | https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/internal/model/WebServiceRequest.ets#L44-L46 | 5ebfe8731534bf607e6757d58a6a10b6eee48461 | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/Search/search/index.ets | arkts | MainPage | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { MainPage } from './src/main/ets/components/mainpage/MainPage' | AST#export_declaration#Left export { MainPage } from './src/main/ets/components/mainpage/MainPage' AST#export_declaration#Right | export { MainPage } from './src/main/ets/components/mainpage/MainPage' | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/Search/search/index.ets#L16-L16 | 021f9174219d5c94e559ca91d8b0f260a9c5a892 | gitee |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Render/SameLayer/EmbedWebView.ets | arkts | EmbedWebView | 星河小程序内部嵌入的webview | @Component
export struct EmbedWebView {
@Prop
data: WebViewParams;
@Prop
parentWebViewId: number
@Prop
webViewId: number
@State
mode: CacheMode = CacheMode.Online;
pageParams: DMPMap = new DMPMap()
@Prop
appIndex: number;
private webViewProxy: DMPWebViewProxy = new DMPWebViewProxy(this.webViewId... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EmbedWebView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right data : AST#type_annotation#Left AST#primary_type#Left WebViewParams AST#primary_type#Right AST#type_an... | @Component
export struct EmbedWebView {
@Prop
data: WebViewParams;
@Prop
parentWebViewId: number
@Prop
webViewId: number
@State
mode: CacheMode = CacheMode.Online;
pageParams: DMPMap = new DMPMap()
@Prop
appIndex: number;
private webViewProxy: DMPWebViewProxy = new DMPWebViewProxy(this.webViewId... | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Render/SameLayer/EmbedWebView.ets#L14-L38 | dfe44319882a41ad3e09a16c5469d2e811844cd7 | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/MoodEntry.ets | arkts | fromRow | Create MoodEntry from database row | static fromRow(row: MoodEntryRow): MoodEntry {
return new MoodEntry(
row.id,
row.date,
row.emotion,
row.intensity,
row.message_count,
row.timestamp
);
} | AST#method_declaration#Left static fromRow AST#parameter_list#Left ( AST#parameter#Left row : AST#type_annotation#Left AST#primary_type#Left MoodEntryRow AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MoodEntry AST#primary... | static fromRow(row: MoodEntryRow): MoodEntry {
return new MoodEntry(
row.id,
row.date,
row.emotion,
row.intensity,
row.message_count,
row.timestamp
);
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/MoodEntry.ets#L58-L67 | 3cbe4316d5b67c6566fc6c8392510f9060b24fec | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | getPrivacyPolicyContent | 获取格式化的隐私政策内容 | private getPrivacyPolicyContent(): string {
return `《生日提醒助手隐私政策》
雄仔很忙工作室(以下简称"我们")深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。
一、我们如何收集和使用您的个人信息
1.1 联系人信息
• 您主动添加的联系人姓名、生日、关系等信息
• 用途:为您提供生日提醒服务
• 存储位置:仅存储在您的本地设备中
1.2 设备信息
• 设备型号、操作系统版本等基本信息
• 用途... | AST#method_declaration#Left private getPrivacyPolicyContent 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... | private getPrivacyPolicyContent(): string {
return `《生日提醒助手隐私政策》
雄仔很忙工作室(以下简称"我们")深知个人信息对您的重要性,并会尽全力保护您的个人信息安全可靠。我们致力于维持您对我们的信任,恪守以下原则保护您的个人信息:权责一致原则、目的明确原则、选择同意原则、最少够用原则、确保安全原则、主体参与原则、公开透明原则等。
一、我们如何收集和使用您的个人信息
1.1 联系人信息
• 您主动添加的联系人姓名、生日、关系等信息
• 用途:为您提供生日提醒服务
• 存储位置:仅存储在您的本地设备中
1.2 设备信息
• 设备型号、操作系统版本等基本信息
• 用途... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6020-L6100 | 042eeacb6afb5ac9e28e7f8ae421db57879801cd | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/pages/Index.ets | arkts | resourceToString | [StartExclude previously_connect_in_onAppear_to_pages_being_loaded] | function resourceToString(resource: Resource) {
return getContext().resourceManager.getStringSync(resource);
} | AST#function_declaration#Left function resourceToString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return... | function resourceToString(resource: Resource) {
return getContext().resourceManager.getStringSync(resource);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry1/src/main/ets/pages/Index.ets#L18-L20 | 17c26c54428146eab16ca18775dcef038663186b | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/model/HotSearchKeyModel.ets | arkts | {
"id": 6,
"link": "",
"name": "面试",
"order": 1,
"visible": 1
} | export class HotSearchKeysModel {
id:number;
link:string;
name:string;
order:number;
visible:number;
} | AST#export_declaration#Left export AST#class_declaration#Left class HotSearchKeysModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left link : AST... | export class HotSearchKeysModel {
id:number;
link:string;
name:string;
order:number;
visible:number;
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/model/HotSearchKeyModel.ets#L10-L16 | 32f9ea8a7bf144e587f1ffe56d36852a421937d5 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets | arkts | formatDynasty | 给我一个表示朝代的字符串 如果有朝代数据 就拼接 [] 如果没有就返回空 | formatDynasty(dynasty: string) {
return dynasty.length === 0 ? '' : '[' + dynasty + ']'
} | AST#method_declaration#Left formatDynasty AST#parameter_list#Left ( AST#parameter#Left dynasty : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left r... | formatDynasty(dynasty: string) {
return dynasty.length === 0 ? '' : '[' + dynasty + ']'
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/OneAutumnUtils.ets#L31-L33 | 659b341911a261c3332dabcb9e5cfac4802245f6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/toolbox/src/main/ets/utils/FloatingWindow.ets | arkts | notifyOrientationChange | 横竖屏切换通知 | notifyOrientationChange() {
if (this.offsetX !== undefined && this.offsetY !== undefined) {
this.screenOrientation = 1 & display.getDefaultDisplaySync().orientation;
let left: number = this.offsetX;
let right: number = this.screenW - left - this.cW;
let top: number = this.offsetY;
let ... | AST#method_declaration#Left notifyOrientationChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left A... | notifyOrientationChange() {
if (this.offsetX !== undefined && this.offsetY !== undefined) {
this.screenOrientation = 1 & display.getDefaultDisplaySync().orientation;
let left: number = this.offsetX;
let right: number = this.screenW - left - this.cW;
let top: number = this.offsetY;
let ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/utils/FloatingWindow.ets#L137-L168 | 492709c5f5eb3e758ab47c1cb14713b8c4079f68 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/AxisRenderer.ets | arkts | getTransformer | Returns the Transformer object used for transforming the axis values.
@return | public getTransformer(): Transformer | null {
return this.mTrans;
} | AST#method_declaration#Left public getTransformer AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Transformer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_stat... | public getTransformer(): Transformer | null {
return this.mTrans;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/AxisRenderer.ets#L109-L111 | 9f4e39a17b68daa69fb100189efe241e5784519a | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | time_bar/src/main/ets/components/viewModel/TimeBarModel.ets | arkts | get | Get the current array of recorded segments.
@returns A copy of the RecordSegment array. | get timeRange(): RecordSegment[] {
return [...this._timeRange]; // return a copy to prevent external modification of internal data
} | AST#method_declaration#Left get AST#ERROR#Left timeRange AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left RecordSegment [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statem... | get timeRange(): RecordSegment[] {
return [...this._timeRange];
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/TimeBarModel.ets#L41-L43 | a7682a0b6005df28dbb786d3c9e88c3e7cce81c6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/textexpand/src/main/ets/view/TextExpand.ets | arkts | TextExpand | 功能描述:本示例介绍了使用@ohos.measure组件接口实现文字段落展开收起的功能,且同时介绍了如何解决图文混排的问题。该场景多用于等。
推荐场景:文字内容过多的场景
核心组件:TextExpandView
实现步骤:
1.设置TextSectionAttribute属性,可以设置文本的最大行数、字体颜色、字体大小、行高以及文本行所占宽度。
@example
class TextSectionAttribute {
maxLines: number;
fontColor: ResourceStr;
fontSize: Resource | number | string;
lineHeight:number;
constr... | @Component
export struct TextExpand {
@State currentIndex: number = 0; // 当前索引
@State changeValue: string = ''; // 搜索框关键词
private controller: TabsController = new TabsController();
private controllerSearch: SearchController = new SearchController();
tabData: TabData[] = [
new TabData(0, $r('app.string.tex... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextExpand AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_an... | @Component
export struct TextExpand {
@State currentIndex: number = 0;
@State changeValue: string = '';
private controller: TabsController = new TabsController();
private controllerSearch: SearchController = new SearchController();
tabData: TabData[] = [
new TabData(0, $r('app.string.text_expand_tab_nam... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textexpand/src/main/ets/view/TextExpand.ets#L111-L217 | 3e7b0a3f4a475d2bbeb5605943c9214ee218bda5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/EmojiDetail.ets | arkts | EmojiDetail | 表情详细信息 | @Component
export struct EmojiDetail {
// 控制器,用以将表情添加到输入框
controllerRich: RichEditorController | undefined = undefined;
// 单个表情模型
EmojiItem: EmojiModel | undefined = undefined;
msgFontSize: number = 0;
// popup状态
@State isPopup: boolean = false;
// 最近使用的表情数据,点击表情之后添加到该数据中
@Link lastEmojiData: LastEmoj... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EmojiDetail AST#component_body#Left { // 控制器,用以将表情添加到输入框 AST#property_declaration#Left controllerRich : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RichEditorController AST#primary_type#Right | ... | @Component
export struct EmojiDetail {
controllerRich: RichEditorController | undefined = undefined;
EmojiItem: EmojiModel | undefined = undefined;
msgFontSize: number = 0;
@State isPopup: boolean = false;
@Link lastEmojiData: LastEmojiData;
@Builder
popupBuilder() {
Column() {
I... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/EmojiDetail.ets#L20-L85 | 38ac6e4cd3fce214c33f983f80a05c316d42f3cf | gitee |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Grids.ets | arkts | aboutToAppear | 颜色数据
生命周期函数,创建组件实例后,执行build渲染函数之前 | aboutToAppear() {
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right | aboutToAppear() {
} | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Grids.ets#L18-L20 | c6de59c5f70dccc2ae0280806859cd6a8a6cdad4 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | The callback of onSelectedItemsDeleted event
@typedef { function } ItemsDeletedCallback
@param { Array<BaseItemInfo> }
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 13 | export type ItemsDeletedCallback = (baseItemInfos: Array<BaseItemInfo>) => void; | AST#export_declaration#Left export AST#type_declaration#Left type ItemsDeletedCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left baseItemInfos : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#L... | export type ItemsDeletedCallback = (baseItemInfos: Array<BaseItemInfo>) => void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L185-L185 | 2138993133b6e9a50afda816f810ce02d93fbf80 | gitee | |
openharmony-sig/ohos_axios | 75d72897982ea6e10fa99c62c62a65425af0a568 | entry/src/main/ets/types/types.ets | arkts | The MIT License (MIT)
Copyright (C) 2023 Huawei Device Co., Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, ... | export interface IdModel {
id?: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IdModel AST#object_type#Left { AST#type_member#Left id ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#... | export interface IdModel {
id?: number
} | https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/types/types.ets#L16-L18 | fe80358b97ae47d946bf3a5fe6345d76d28484df | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/privacyagreement/Index.ets | arkts | PrivacyAgreement | 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 { PrivacyAgreement } from './src/main/ets/components/PrivacyAgreement'; | AST#export_declaration#Left export { PrivacyAgreement } from './src/main/ets/components/PrivacyAgreement' ; AST#export_declaration#Right | export { PrivacyAgreement } from './src/main/ets/components/PrivacyAgreement'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/privacyagreement/Index.ets#L15-L15 | 4acaaa2932011e1ded24cf6fb7e4ee3c8e60b3e7 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragandexchange/src/main/ets/model/AppInfo.ets | arkts | AppInfo | App信息,包括图标、名字、是否可见 | @Observed
export class AppInfo {
icon: ResourceStr = ''; // 应用图标
name: ResourceStr = ''; // 应用名称
visible: boolean = true; // 是否可见
constructor(icon: ResourceStr = '', name: ResourceStr = '', visible: boolean = true) {
this.icon = icon;
this.name = name;
this.visible = visible;
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class AppInfo AST#class_body#Left { AST#property_declaration#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Righ... | @Observed
export class AppInfo {
icon: ResourceStr = '';
name: ResourceStr = '';
visible: boolean = true;
constructor(icon: ResourceStr = '', name: ResourceStr = '', visible: boolean = true) {
this.icon = icon;
this.name = name;
this.visible = visible;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/model/AppInfo.ets#L19-L30 | 1a4fe92393e322591665c32e450eb62f36b2df38 | gitee |
wenfujing/honms-super-market.git | 0858abecd8be5db7b8dcf88dcd77b7c66d37517a | common/src/main/ets/utils/BreakpointSystem.ets | arkts | 媒体查询的查询条件,并返回对应的监听句柄 | export class BreakpointSystem{
private currentBreakpoint: string = '';
private smListener?: mediaQuery.MediaQueryListener;
private mdListener?: mediaQuery.MediaQueryListener;
private lgListener?: mediaQuery.MediaQueryListener;
private updateCurrentBreakpoint(breakpoint: string) {
if (this.currentBreakpoi... | AST#export_declaration#Left export AST#class_declaration#Left class BreakpointSystem AST#class_body#Left { AST#property_declaration#Left private currentBreakpoint : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#... | export class BreakpointSystem{
private currentBreakpoint: string = '';
private smListener?: mediaQuery.MediaQueryListener;
private mdListener?: mediaQuery.MediaQueryListener;
private lgListener?: mediaQuery.MediaQueryListener;
private updateCurrentBreakpoint(breakpoint: string) {
if (this.currentBreakpoi... | https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/BreakpointSystem.ets#L28-L73 | b466c7a24b491e77e8224b4b3251cbb7bf4b492a | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildGreetingsContent | 构建祝福语内容 | @Builder
buildGreetingsContent() {
Column({ space: 16 }) {
// 祝福语类型选择
Row({ space: 8 }) {
ForEach(['通用', '朋友', '家人', '同事', '长辈'], (type: string) => {
Button(type)
.type(ButtonType.Capsule)
.fontSize(12)
.height(28)
.backgroundColor(type... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingsContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compone... | @Builder
buildGreetingsContent() {
Column({ space: 16 }) {
Row({ space: 8 }) {
ForEach(['通用', '朋友', '家人', '同事', '长辈'], (type: string) => {
Button(type)
.type(ButtonType.Capsule)
.fontSize(12)
.height(28)
.backgroundColor(type === '通用' ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1004-L1130 | 871effb3ba5e47d1a4cde22e580c451382ae8768 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets | arkts | @file 本地存储示例页 ViewModel
@author Joker.X | @ObservedV2
export default class LocalStorageViewModel extends BaseViewModel {
/**
* 账号输入
*/
@Trace
accountInput: string = "";
/**
* 已存储账号
*/
@Trace
storedAccount: string = "";
/**
* 本地存储仓库
*/
private repository: AccountStoreRepository = new AccountStoreRepository();
/**
* 更新账号输入... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class LocalStorageViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 账号输入
*/ ... | @ObservedV2
export default class LocalStorageViewModel extends BaseViewModel {
@Trace
accountInput: string = "";
@Trace
storedAccount: string = "";
private repository: AccountStoreRepository = new AccountStoreRepository();
updateAccountInput(value: string): void {
this.accountInput = value;... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets#L8-L53 | 4d11c5cc1a648393c89cbb632a2b4ca9964494fc | github | |
Yize9/ohos_swig_example.git | b98216fd7884dd95a77c8ed7ade3ac1a6ffd83c4 | entry/src/main/ets/pages/Task.ets | arkts | Call | @Concurrent export function taskExecute(task: Task): /*Promise<*/boolean | void | null/*>*/ { return task.execute(); } @Sendable export class Task implements IUniqueSendable{ ptrId?: string public execute(): /*Promise<*//*TaskResultModel | */boolean | null|void/*>*/{ } } | @Sendable
export class Call{
toTs(): number {
console.log(`>>>>>>> call toTs`);
return 1;
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class Call AST#class_body#Left { AST#method_declaration#Left toTs 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 A... | @Sendable
export class Call{
toTs(): number {
console.log(`>>>>>>> call toTs`);
return 1;
}
} | https://github.com/Yize9/ohos_swig_example.git/blob/b98216fd7884dd95a77c8ed7ade3ac1a6ffd83c4/entry/src/main/ets/pages/Task.ets#L16-L22 | 1929840b7674ac38beb709f5b894204ecd73c65c | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Enumerated value: addition, subtraction, multiplication, and division. | export enum SymbolicEnumeration {
ADD = '+',
MIN = '-',
MUL = '×',
DIV = '÷'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum SymbolicEnumeration AST#enum_body#Left { AST#enum_member#Left ADD = AST#expression#Left '+' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MIN = AST#expression#Left '-' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ... | export enum SymbolicEnumeration {
ADD = '+',
MIN = '-',
MUL = '×',
DIV = '÷'
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/common/constants/CommonConstants.ets#L119-L124 | 7b4f9b7b6f627d806f619a18cba4895719b7485e | gitee | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/view/UserProfileComponent.ets | arkts | updateProfileItems | 更新资料列表 | updateProfileItems() {
if (!this.userInfo) return;
this.profileItems = [
{ icon: $r('app.media.ic_mine_nickname'), title: 'Nickname', key: 'nickname', value: this.userInfo.nickname || this.userInfo.username || 'Not set', editable: true },
{ icon: $r('app.media.ic_mine_gender'), title: 'Gender', key... | AST#method_declaration#Left updateProfileItems AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#un... | updateProfileItems() {
if (!this.userInfo) return;
this.profileItems = [
{ icon: $r('app.media.ic_mine_nickname'), title: 'Nickname', key: 'nickname', value: this.userInfo.nickname || this.userInfo.username || 'Not set', editable: true },
{ icon: $r('app.media.ic_mine_gender'), title: 'Gender', key... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L152-L165 | e7519abf3cdf980eea0271bd8c16313c735d8962 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/wrap_builder/ChildWrapBuilder0020.ets | arkts | ChildWrapBuilder0020 | 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... | @Builder
export function ChildWrapBuilder0020(msg: string, color: ResourceColor) {
Text(msg)
.id('tvChildWrapBuilder0020')
.fontColor(color)
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ChildWrapBuilder0020 AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c... | @Builder
export function ChildWrapBuilder0020(msg: string, color: ResourceColor) {
Text(msg)
.id('tvChildWrapBuilder0020')
.fontColor(color)
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/wrap_builder/ChildWrapBuilder0020.ets#L16-L21 | 9b275a9dd51a90d8da057324f81a9ff8bfe5f71b | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/AudioUtil.ets | arkts | stopRecording | 停止音频采集
@returns | static async stopRecording(): Promise<string> {
if (AudioUtil.audioCapturer !== undefined) {
// 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止
if ((AudioUtil.audioCapturer as audio.AudioCapturer).state.valueOf() !== audio.AudioState.STATE_RUNNING &&
(AudioUtil.audioCapturer as audio.AudioCapturer).s... | AST#method_declaration#Left static async stopRecording AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AS... | static async stopRecording(): Promise<string> {
if (AudioUtil.audioCapturer !== undefined) {
if ((AudioUtil.audioCapturer as audio.AudioCapturer).state.valueOf() !== audio.AudioState.STATE_RUNNING &&
(AudioUtil.audioCapturer as audio.AudioCapturer).state.valueOf() !== audio.AudioState.STATE_PAU... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/AudioUtil.ets#L93-L108 | bdbf4c2de83e486a1fb34407278df414611635b7 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | deleteDeletedWords | 清空已删除单词标记 | async deleteDeletedWords(): Promise<void> {
this.allWords.forEach(word => {
word.deleted = false;
});
await WordUserDbAccess.shared.clearDeletedWords();
} | AST#method_declaration#Left async deleteDeletedWords 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#ty... | async deleteDeletedWords(): Promise<void> {
this.allWords.forEach(word => {
word.deleted = false;
});
await WordUserDbAccess.shared.clearDeletedWords();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L827-L832 | 96137285204e4c39d41064f1aa24dd7ffe0edb5b | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/ShellSort.ets | arkts | sort | 希尔排序算法
@param arr 需要排序的数组
@returns 排序后的数组 | public static sort(arr: number[]): number[] {
const result = [...arr];
const n = result.length;
// 初始间隔
for (let gap = Math.floor(n / 2); gap > 0; gap = Math.floor(gap / 2)) {
// 对每个子序列进行插入排序
for (let i = gap; i < n; i++) {
const temp: number = result[i];
let j: number;
... | AST#method_declaration#Left public static sort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ... | public static sort(arr: number[]): number[] {
const result = [...arr];
const n = result.length;
for (let gap = Math.floor(n / 2); gap > 0; gap = Math.floor(gap / 2)) {
for (let i = gap; i < n; i++) {
const temp: number = result[i];
let j: number;
for (j =... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/ShellSort.ets#L10-L30 | 6129702c573547f72f4a09bb8f1d2bb8f3d7b2a0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets | arkts | getListOffset | MyScroller获取List组件的yOffset | getListOffset():number{
return this.listScroller.currentOffset().yOffset;
} | AST#method_declaration#Left getListOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression... | getListOffset():number{
return this.listScroller.currentOffset().yOffset;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L163-L165 | a3b631b3211f9330bab89a1fcdd1100b2c0246d4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets | arkts | ListExchange | 功能描述:
1. 长按列表项,向上或向下拖动,当前列表项和目标列表项位置互换。
2. 列表项向左滑动,显示删除按钮。
3. 点击删除按钮,当前列表项删除。
实现原理:
1. 创建一个数组modifier来添加自定义属性对象,根据组合手势GestureGroup来控制自定义属性的值并通过attributeModifier绑定自定义属性对象来动态加载属性。
2. 然后swipeAction属性绑定删除组件,左滑显示此删除组件,点击实现列表项的删除。
@param appInfoList - 列表数据
@param appInfoList - 列表元素交换类
@param deductionView - 列表项UI模块 | @Component
export struct ListExchange {
// -------------------对外暴露变量-----------------------
@Link appInfoList: Object[];
// 控制列表项交换的类
@Link listExchangeCtrl: ListExchangeCtrl<Object>;
// 列表项Builder
@BuilderParam deductionView: (listInfo: Object) => void;
// --------------------私有属性------------------------... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListExchange AST#component_body#Left { // -------------------对外暴露变量----------------------- AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right appInfoList : AST#type_annotation#Left AST#primary... | @Component
export struct ListExchange {
@Link appInfoList: Object[];
@Link listExchangeCtrl: ListExchangeCtrl<Object>;
@BuilderParam deductionView: (listInfo: Object) => void;
@State currentListItem: Object | undefined = undefined;
@State isLongPress: boolean = false;
build() {
Column... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets#L35-L168 | a898f9ebba9ced1ed588c94036182a5dfe68dd10 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | buildMiniPlayer | 构建迷你播放器 - QQ音乐风格 | @Builder
buildMiniPlayer() {
Column() {
// 进度条
Row() {
Progress({ value: this.playProgress, total: 100, type: ProgressType.Linear })
.width('100%')
.height(2)
.color($r('app.color.primary'))
.backgroundColor($r('app.color.progress_track'))
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMiniPlayer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 进度条 AST#ar... | @Builder
buildMiniPlayer() {
Column() {
Row() {
Progress({ value: this.playProgress, total: 100, type: ProgressType.Linear })
.width('100%')
.height(2)
.color($r('app.color.primary'))
.backgroundColor($r('app.color.progress_track'))
}
.width... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L1222-L1350 | ae15b28bf150c2f62595d2bf8c0ee224a4b4055f | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/timer/TimerComponent.ets | arkts | aboutToDisappear | 界面被销毁时被调用。 | aboutToDisappear() {
this.stopTimer();
this.unsubscribeMsg();
} | AST#method_declaration#Left aboutToDisappear 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 . stopTimer AST#membe... | aboutToDisappear() {
this.stopTimer();
this.unsubscribeMsg();
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerComponent.ets#L48-L51 | c2b72c9e6a579f105eae24e2ed704533bbaa34c9 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets | arkts | notifyDataMove | 通知控制器数据位置变化
@param from 起始位置
@param to 最终位置 | notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right... | notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L84-L88 | db52b025fe674e9f7214872a470d36a7d1e81da2 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/VoiceService.ets | arkts | initializeTTS | 初始化TTS引擎 | private async initializeTTS(): Promise<void> {
try {
this.ttsEngine = await textToSpeech.createEngine({
language: this.defaultTTSConfig.language,
voice: this.defaultTTSConfig.voice
});
// 设置TTS事件监听
this.ttsEngine.on('start', () => {
this.isSpeaking = true;
hi... | AST#method_declaration#Left private async initializeTTS AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST... | private async initializeTTS(): Promise<void> {
try {
this.ttsEngine = await textToSpeech.createEngine({
language: this.defaultTTSConfig.language,
voice: this.defaultTTSConfig.voice
});
this.ttsEngine.on('start', () => {
this.isSpeaking = true;
hilog.info(Log... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L114-L141 | 0457e737824163bef885c8f1336626e8c7efe40b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/social/SearchPage.ets | arkts | buildSearchSuggestions | 构建搜索建议 | @Builder
buildSearchSuggestions() {
Scroll() {
Column({ space: 24 }) {
// 最近搜索
if (this.recentSearches.length > 0) {
Column({ space: 12 }) {
Row() {
Text('最近搜索')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
... | 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.recentSearches.length > 0) {
Column({ space: 12 }) {
Row() {
Text('最近搜索')
.fontSize(16)
.fontColor($r('app.color.text_primary'))
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/SearchPage.ets#L222-L335 | 1a968da130eb3fb6f1608984fc4eb6641e3430c4 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | sign | 对数据进行签名,异步
@param dataBlob 待签名数据
@param priKey 私钥
@param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。
@returns | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.sign(dataBlob, priKey, algName);
} | AST#method_declaration#Left static async sign AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKe... | static async sign(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
algName: string = 'SM2_256|SM3'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.sign(dataBlob, priKey, algName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L210-L213 | 24ec8041e23ad470cfe4293a86db6803b0b0f8e8 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets | arkts | httpRequest | 订阅HTTP流式响应数据接收进度事见 | httpRequest.on('dataReceiveProgress', (data: Data) => {
Logger.info(`${LOG_TAG} dataReceiveProgress receiveSize: ${data.receiveSize},totalSize: ${data.totalSize}`);
} | AST#method_declaration#Left httpRequest AST#ERROR#Left . on ( 'dataReceiveProgress' , AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Data AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => ... | httpRequest.on('dataReceiveProgress', (data: Data) => {
Logger.info(`${LOG_TAG} dataReceiveProgress receiveSize: ${data.receiveSize},totalSize: ${data.totalSize}`);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/HTTP_case/entry/src/main/ets/pages/Index.ets#L190-L192 | 5e093e20be94a9aa3f5fe255ce350d2ecf3944e7 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/PreferencesService.ets | arkts | putArray | 存储数组值(转换为JSON字符串)
@param key 键
@param value 数组值 | async putArray<T>(key: string, value: T[]): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.putString(key, jsonString);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to put array: ${businessError... | AST#method_declaration#Left async putArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Rig... | async putArray<T>(key: string, value: T[]): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.putString(key, jsonString);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to put array: ${businessError... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L166-L175 | 996cef8d9bd900bb41434b4efb95031e623f1874 | github |
softfatgay/harmony-netease.git | 5f3d226b72ba8579cacfbd229e4eb0054d63abef | entry/src/main/ets/base/Api.ets | arkts | /购物车 | export const CART_TRADE = baseUrl + '/xhr/front/trade/cart/getCarts'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CART_TRADE = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/front/trade/cart/getCarts' AST#expression#Right AST#binary_expression#Right AST#exp... | export const CART_TRADE = baseUrl + '/xhr/front/trade/cart/getCarts'; | https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L70-L70 | c056451493f01d3e2245668b7e031d1356778ae5 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | buildBirthdayStats | 构建数据概览模块 | @Builder
buildBirthdayStats() {
Column({ space: 16 }) {
Text('数据概览')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
// 统计卡片网格
Column({ space: 12 }) {
// 第一行
Row({ space: 12 }) {
// 总联系人
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayStats AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_... | @Builder
buildBirthdayStats() {
Column({ space: 16 }) {
Text('数据概览')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
Column({ space: 12 }) {
Row({ space: 12 }) {
this.buildStatC... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L463-L507 | ab07f365e4c5d8b0dbc5b3aba108da3e0498827e | github |
queyun123/weatherApp-ArkTS.git | 6beee6640db32ae70c342866b24fc643a9c512bf | entry/src/main/ets/utils/StorageUtil.ets | arkts | getLastCity | 获取上次选择的城市 | static async getLastCity(): Promise<LastCity> {
try {
const initSuccess = await StorageUtil.init();
if (!initSuccess || !StorageUtil.prefs) {
return { name: '北京', id: '101010100' };
}
const name = await StorageUtil.prefs.get(StorageKeys.LAST_CITY_NAME, '北京');
const id = await ... | AST#method_declaration#Left static async getLastCity 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 LastCity AST#primary_type#Right AST#type_annotation#Right > AS... | static async getLastCity(): Promise<LastCity> {
try {
const initSuccess = await StorageUtil.init();
if (!initSuccess || !StorageUtil.prefs) {
return { name: '北京', id: '101010100' };
}
const name = await StorageUtil.prefs.get(StorageKeys.LAST_CITY_NAME, '北京');
const id = await ... | https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/utils/StorageUtil.ets#L63-L82 | 295cf579e64607f757c2d91de47a64999d712372 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/MD5.ets | arkts | digest | 对称密钥SymKey
MD5摘要,同步
@param data 待摘要的数据
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@returns | static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
return CryptoUtil.digest(data, 'MD5', resultCoding);
} | AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_... | static async digest(data: string, resultCoding: crypto.BhCoding = 'hex'): Promise<string> {
return CryptoUtil.digest(data, 'MD5', resultCoding);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/MD5.ets#L37-L39 | e0e4f4e09764992e9399f99f8500096c484ce715 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets | arkts | Declare class TreeListener
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare class TreeListener
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class TreeListener {
/**
* Event registration and processing.
* The event will not be destroyed after being processed.
*
* @param { type } event Registered Events.
* @param { callback }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* ... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TreeListener AST#class_body#Left { /**
* Event registration and processing.
* The event will not be destroyed after being processed.
*
* @param { type } event Registered Events.
* @param {... | export declare class TreeListener {
on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void;
off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void)... | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets#L105-L164 | b9abb0779ca62491f94ae90d9636826c1b657781 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragandexchange/Index.ets | arkts | Launcher | 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 { Launcher } from './src/main/ets/pages/Launcher' | AST#export_declaration#Left export { Launcher } from './src/main/ets/pages/Launcher' AST#export_declaration#Right | export { Launcher } from './src/main/ets/pages/Launcher' | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/Index.ets#L15-L15 | 87a33014658e4401beb9f13b5bab45b2a6895b52 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/demo/entry/src/main/ets/common/SettingPublicLayout.ets | arkts | isBorderFn | 两种形式,1、无圆角,2、全圆角,3、下左下右圆角,4、上左上右圆角
默认不传 无圆角
isModeBol = true borderBol= false 全圆角
isModeBol = true borderBol= true borderBole = false 下左下右圆角
isModeBol = true borderBol= true borderBole = true 上左上右圆角 | isBorderFn(): BorderRadiuses {
if (this.isModeBol) {
if (this.borderBol) {
if (this.borderBole) {
return { topLeft: 16, topRight: 16 };
} else {
return { bottomLeft: 16, bottomRight: 16 };
}
} else {
return { topLeft: 16, topRight: 16, bottomLeft: 16, ... | AST#method_declaration#Left isBorderFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left BorderRadiuses AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#... | isBorderFn(): BorderRadiuses {
if (this.isModeBol) {
if (this.borderBol) {
if (this.borderBole) {
return { topLeft: 16, topRight: 16 };
} else {
return { bottomLeft: 16, bottomRight: 16 };
}
} else {
return { topLeft: 16, topRight: 16, bottomLeft: 16, ... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/common/SettingPublicLayout.ets#L61-L75 | 91c433376800614bff203ab5cbfa9eb4a9686ad5 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets | arkts | avTranscoderDemo | 一个完整的【开始转码-暂停转码-恢复转码-转码完成】示例。 | async avTranscoderDemo() {
await this.startTranscoderingProcess(); // 开始转码。
await this.pauseTranscoderingProcess(); //暂停转码。
await this.resumeTranscoderingProcess(); // 恢复转码。
} | AST#method_declaration#Left async avTranscoderDemo 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 AST#await_expression#Left await AST#expre... | async avTranscoderDemo() {
await this.startTranscoderingProcess();
await this.pauseTranscoderingProcess();
await this.resumeTranscoderingProcess();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets#L128-L132 | f8543602961afcefdf9332386f384436317a1c21 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/HomeComponent.ets | arkts | accountingItemClickAction | 触发点击或者长按记账记录事件 | accountingItemClickAction(item: AccountingInfo, isClick: boolean): void {
// 触发点击或者长按记账记录事件
if (isClick) {
// 编辑记账信息
router.pushUrl({
url: 'pages/AddAccountingPage',
params: {params: JSON.stringify(item)}
});
}
else {
}
} | AST#method_declaration#Left accountingItemClickAction AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left AccountingInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isClick : AST#type_annotation#Left AST#primary_type#Left boole... | accountingItemClickAction(item: AccountingInfo, isClick: boolean): void {
if (isClick) {
router.pushUrl({
url: 'pages/AddAccountingPage',
params: {params: JSON.stringify(item)}
});
}
else {
}
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/HomeComponent.ets#L122-L134 | fba4ef9073738148777a2c5d9d7e648986241db1 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/AudioPlayer/entry/src/main/ets/viewmodel/MusicItem.ets | arkts | Song entity class. | export class MusicItem {
/**
* Identifier.
*/
id: number = 0;
/**
* Music name.
*/
name: string = '';
/**
* Singer.
*/
singer: string = '';
/**
* Lyricist.
*/
lyrics: string = '';
/**
* Resource Path.
*/
path: string = '';
/**
* Member song or not.
*/
isVip: b... | AST#export_declaration#Left export AST#class_declaration#Left class MusicItem AST#class_body#Left { /**
* Identifier.
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#prop... | export class MusicItem {
id: number = 0;
name: string = '';
singer: string = '';
lyrics: string = '';
path: string = '';
isVip: boolean = false;
image: Resource = $r('app.media.icon');
rawFileDescriptor: resourceManager.RawFileDescriptor = {} as resourceManager.RawFileDescriptor;... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/viewmodel/MusicItem.ets#L21-L54 | 19329d44209e449bd02f9da2a59cc6f1b0596789 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets | arkts | Position enum of the extra region
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export enum ExtraRegionPosition {
/**
* The extra region position is in the top.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
TOP = 1,
/**
* The extra region position is in the bottom.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | AST#export_declaration#Left export AST#enum_declaration#Left enum ExtraRegionPosition AST#enum_body#Left { /**
* The extra region position is in the top.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#enum_member#Left TOP = AST#expression#Left 1 A... | export enum ExtraRegionPosition {
TOP = 1,
BOTTOM = 2,
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets#L44-L64 | a1a527d8c7302bd35dbd4d8cf5270460b5f26ef8 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/greeting/GreetingService.ets | arkts | updateGreeting | 更新祝福语
@param params 更新参数
@returns 更新后的祝福语 | async updateGreeting(params: UpdateGreetingParams): Promise<Greeting> {
try {
// 获取原有祝福语数据
const existingGreeting = await this.getGreetingById(params.id);
if (!existingGreeting) {
throw new Error('祝福语不存在');
}
// 更新祝福语对象
const updatedGreeting: Greeting = {
...exis... | AST#method_declaration#Left async updateGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left UpdateGreetingParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#... | async updateGreeting(params: UpdateGreetingParams): Promise<Greeting> {
try {
const existingGreeting = await this.getGreetingById(params.id);
if (!existingGreeting) {
throw new Error('祝福语不存在');
}
const updatedGreeting: Greeting = {
...existingGreeting,
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/greeting/GreetingService.ets#L107-L155 | b94f9e6ff9e02bf26e190eb163a279c22c933aae | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/FloatWindowController.ets | arkts | 悬浮窗控制类 | export default class FloatWindowController {
// 创建单例模式
private static mInstance: FloatWindowController | null = null;
public static getInstance(): FloatWindowController {
if (FloatWindowController.mInstance == null) {
FloatWindowController.mInstance = new FloatWindowController();
}
return Floa... | AST#export_declaration#Left export default AST#class_declaration#Left class FloatWindowController AST#class_body#Left { // 创建单例模式 AST#property_declaration#Left private static mInstance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FloatWindowController AST#primary_type#Right | AST#primary_type#Le... | export default class FloatWindowController {
private static mInstance: FloatWindowController | null = null;
public static getInstance(): FloatWindowController {
if (FloatWindowController.mInstance == null) {
FloatWindowController.mInstance = new FloatWindowController();
}
return FloatWindowCo... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/controller/FloatWindowController.ets#L26-L104 | 1b33dd5b490305c5f3887056ab84a2823aa317ab | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/ReuseFramePage.ets | arkts | initCalenderData | 当前周几 初始化日历中一年的数据 | initCalenderData() {
// 添加自定义trace标签,用于在trace抓取结果中查看相关运行时间信息
hiTraceMeter.startTrace('push_data_direct', 1);
for (let k = this.currentYear; k < 2035; k++) {
for (let i = 1; i <= 12; i++) {
// 获取每个月的日数据
const monthDays: number[] = getMonthDate(i, k);
const lunarDays: string[] = ... | AST#method_declaration#Left initCalenderData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 添加自定义trace标签,用于在trace抓取结果中查看相关运行时间信息 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression... | initCalenderData() {
hiTraceMeter.startTrace('push_data_direct', 1);
for (let k = this.currentYear; k < 2035; k++) {
for (let i = 1; i <= 12; i++) {
const monthDays: number[] = getMonthDate(i, k);
const lunarDays: string[] = [];
for (let j = 0; j < monthDays.length; j... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/highlyloadedcomponentrender/src/main/ets/pages/ReuseFramePage.ets#L46-L72 | 9a636aad0f4c53b370a5dd0dc6bb9389f61505c6 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getAllNets | 获取所有处于连接状态的网络列表
@returns | static getAllNets(): Promise<Array<connection.NetHandle>> {
return connection.getAllNets();
} | AST#method_declaration#Left static getAllNets 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 Array AST#type_arguments#Left < AST#type_annota... | static getAllNets(): Promise<Array<connection.NetHandle>> {
return connection.getAllNets();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L102-L104 | 8f9d842c1adc2bd9429d850041c94ec98b7b372c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customstepper/src/main/ets/view/CustomStepperView.ets | arkts | CustomStepperViewComponent | 功能描述: 在许多场景下,我们都需要引导用户按照步骤完成任务,此功能在HarmonyOS Next中可以使用Stepper来实现,但是Stepper的定制化能力较弱,开发者无法定制上下页切换按钮的样式、位置,因此本例介绍了如何基于Swiper实现Stepper的能力。
推荐场景: 问卷填写以及一些应用的功能指导场景
核心组件:
1. CategoryView
2. UserNoticeView
实现步骤:
1. 页面公共部分置于最外层
2. 使用swiper控制页面前进后退流程,页面主体内容由swiper承载
3. 为了便于做数据较验,将前进/后退的控制按钮置于swiper item中
4. 每个页面的数据校验通过回调验证,只... | @Component
export struct CustomStepperViewComponent {
@State currentIndex: number = 0; // 当前页面的索引,用以和HeaderView中的文字部分联动
pageTitleArray: string[] = // HeaderView中的title字段列表,每个页面都有自己的title
getContext(this).resourceManager.getStringArrayValueSync($r("app.strarray.stepper_title_array").id);
lastIndex: number = th... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomStepperViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | @Component
export struct CustomStepperViewComponent {
@State currentIndex: number = 0;
pageTitleArray: string[] =
getContext(this).resourceManager.getStringArrayValueSync($r("app.strarray.stepper_title_array").id);
lastIndex: number = this.pageTitleArray.length - 1;
submitInfo: SubmitInfoWrapper = new Su... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/src/main/ets/view/CustomStepperView.ets#L38-L87 | 63ef2759b48123b105e3ea9419d3dad0c29da252 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets | arkts | showRingLoadingText | / 加载中 - 圆环样式 | public static showRingLoadingText(loadingText = '加载中...') {
JhProgressHUD._showLoading(loadingText)
} | AST#method_declaration#Left public static showRingLoadingText AST#parameter_list#Left ( AST#parameter#Left loadingText = AST#expression#Left '加载中...' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression... | public static showRingLoadingText(loadingText = '加载中...') {
JhProgressHUD._showLoading(loadingText)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L74-L76 | 6418aef8f78d94f8506559066baea185d2da6387 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | calculateMultiplier | 计算积分倍数 | private calculateMultiplier(action: GameAction, metadata: Record<string, any>): number {
let multiplier = 1.0;
// 等级奖励
if (this.userGameData) {
const levelBonus = this.userGameData.level.benefits
.find(b => b.type === BenefitType.EXTRA_POINTS);
if (levelBonus) {
multiplier += le... | AST#method_declaration#Left private calculateMultiplier AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left GameAction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left metadata : AST#type_annotation#Left AST#primary_type#Left AST#... | private calculateMultiplier(action: GameAction, metadata: Record<string, any>): number {
let multiplier = 1.0;
if (this.userGameData) {
const levelBonus = this.userGameData.level.benefits
.find(b => b.type === BenefitType.EXTRA_POINTS);
if (levelBonus) {
multiplier += levelBonu... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L616-L643 | 150f25e428407060c836f7f6a4f95164025fdcf3 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/constants/AppConstants.ets | arkts | 业务逻辑常量 | export class BusinessConstants {
// 联系人相关
static readonly MAX_CONTACTS = 1000;
static readonly MIN_CONTACT_NAME_LENGTH = 1;
static readonly MAX_CONTACT_NAME_LENGTH = 50;
static readonly MAX_TAGS_PER_CONTACT = 10;
static readonly MAX_TAG_LENGTH = 20;
static readonly DEFAULT_INTIMACY_LEVEL = 3;
static rea... | AST#export_declaration#Left export AST#class_declaration#Left class BusinessConstants AST#class_body#Left { // 联系人相关 AST#property_declaration#Left static readonly MAX_CONTACTS = AST#expression#Left 1000 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MIN_CONTACT_NAME_... | export class BusinessConstants {
static readonly MAX_CONTACTS = 1000;
static readonly MIN_CONTACT_NAME_LENGTH = 1;
static readonly MAX_CONTACT_NAME_LENGTH = 50;
static readonly MAX_TAGS_PER_CONTACT = 10;
static readonly MAX_TAG_LENGTH = 20;
static readonly DEFAULT_INTIMACY_LEVEL = 3;
static readonly MI... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/constants/AppConstants.ets#L160-L204 | 8bf3781890c2514bb047174fa66373c0aea7469e | github | |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/pages/component/WuDangBuySellComponent.ets | arkts | _drawUI | 绘制UI | _drawUI() {
this._clearCanvas()
this._drawWuDangUI()
} | AST#method_declaration#Left _drawUI 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 . _clearCanvas AST#member_expr... | _drawUI() {
this._clearCanvas()
this._drawWuDangUI()
} | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/WuDangBuySellComponent.ets#L40-L43 | abaf81351c16b5d4b9b4787ed4920fc1838250d1 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/utils/PhotoHelperPage.ets | arkts | selectSingle | 相册选择图片(单选) | selectSingle(){
let options: photoAccessHelper.PhotoSelectOptions = {
MIMEType: photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE,
maxSelectNumber: 1,
isOriginalSupported: true,
isPreviewForSingleSelectionSupported: true //单选模式下是否需要进大图预览
}
PhotoHelper.selectEasy(options).then((uris) =>... | AST#method_declaration#Left selectSingle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . PhotoSelectOptio... | selectSingle(){
let options: photoAccessHelper.PhotoSelectOptions = {
MIMEType: photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE,
maxSelectNumber: 1,
isOriginalSupported: true,
isPreviewForSingleSelectionSupported: true
}
PhotoHelper.selectEasy(options).then((uris) => {
this.ur... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/utils/PhotoHelperPage.ets#L132-L144 | 36c498dcc8e103278b1676757746eb240dbb0fd4 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/ui_tools.ets | arkts | Checks if some dialogs are already opened.
@param storage The LocalStorage
@returns True or False. | export function is_some_dialogs_opened(storage: LocalStorage) {
let opened_dialog_controllers = storage.get('opened_dialog_controllers') as CustomDialogController[];
if (opened_dialog_controllers && opened_dialog_controllers.length > 0) {
// console.log('[is_some_dialogs_opened] True! ' + opened_dialog_controll... | AST#export_declaration#Left export AST#function_declaration#Left function is_some_dialogs_opened AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_st... | export function is_some_dialogs_opened(storage: LocalStorage) {
let opened_dialog_controllers = storage.get('opened_dialog_controllers') as CustomDialogController[];
if (opened_dialog_controllers && opened_dialog_controllers.length > 0) {
return true;
}
return false;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L32-L39 | 43af5fb00678d2d347e5a1dae96e950899372c29 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM2.ets | arkts | getCipherTextSpec | 获取转换SM2密文格式,ASN.1格式转换为C1C2C3或C1C3C2
@param cipherText ASN.1格式的SM2密文参数
@param cipherMode 0-C1C2C3 、1-C1C3C2,默认为0
@returns | static getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string {
try {
let spec: cryptoFramework.SM2CipherTextSpec = cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2');
let startPre = "04";
// bigint 转十六进制需要补零,参考BC转换
let c1x = CryptoHelper.toHexWi... | AST#method_declaration#Left static getCipherTextSpec AST#parameter_list#Left ( AST#parameter#Left cipherText : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L... | static getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string {
try {
let spec: cryptoFramework.SM2CipherTextSpec = cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2');
let startPre = "04";
let c1x = CryptoHelper.toHexWithPaddingZero(spec.xCoordi... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L181-L200 | e04e44d87f58dff6f7bdd8caad8c100ea5d00dac | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionUpdate | Callback when the Pan gesture is moving.
@param { Callback<GestureEvent> } event
@returns { PanGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionUpdate(event: Callback<GestureEvent>): PanGesture; | AST#method_declaration#Left onActionUpdate AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right > AST#type_... | onActionUpdate(event: Callback<GestureEvent>): PanGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L504-L504 | fc2e9e60ed0b1a41ad4db7caf3e3fc6857f3c901 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets | arkts | getTime | 获取当前时间并格式化 | private getTime(hour: number, minute: number, second: number): string {
let hourPrefix = '';
let minutePrefix = '';
let secondPrefix = '';
if (hour < TIME_DEMARCATION) {
hourPrefix = TIME_PREFIX;
}
if (minute < TIME_DEMARCATION) {
minutePrefix = TIME_PREFIX;
}
if (second < TI... | AST#method_declaration#Left private getTime AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minute : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | private getTime(hour: number, minute: number, second: number): string {
let hourPrefix = '';
let minutePrefix = '';
let secondPrefix = '';
if (hour < TIME_DEMARCATION) {
hourPrefix = TIME_PREFIX;
}
if (minute < TIME_DEMARCATION) {
minutePrefix = TIME_PREFIX;
}
if (second < TI... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets#L232-L246 | 39aef8662821d7c4ac78136fac2489c7ce8aab46 | gitee |
xixi-cquer/ShouZhiJiZhang.git | aafb992b704f758715c5ee21e6cb636b467be7de | entry/src/main/ets/viewmodel/ConstantsInterface.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export interface AccountTable {
tableName: string;
sqlCreate: string;
columns: string[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AccountTable AST#object_type#Left { AST#type_member#Left tableName : 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 sqlCreate : AST#type_annota... | export interface AccountTable {
tableName: string;
sqlCreate: string;
columns: string[];
} | https://github.com/xixi-cquer/ShouZhiJiZhang.git/blob/aafb992b704f758715c5ee21e6cb636b467be7de/entry/src/main/ets/viewmodel/ConstantsInterface.ets#L16-L20 | c74138bee04d0d5e8e42604bc916b57118889510 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/ContactsPage.ets | arkts | getRelationLabel | 获取关系标签 | private getRelationLabel(relation: RelationType): string {
const labels: Record<RelationType, string> = {
[RelationType.FAMILY]: '家人',
[RelationType.FRIEND]: '朋友',
[RelationType.COLLEAGUE]: '同事',
[RelationType.OTHER]: '其他'
};
return labels[relation] || '其他';
} | AST#method_declaration#Left private getRelationLabel AST#parameter_list#Left ( AST#parameter#Left relation : AST#type_annotation#Left AST#primary_type#Left RelationType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string... | private getRelationLabel(relation: RelationType): string {
const labels: Record<RelationType, string> = {
[RelationType.FAMILY]: '家人',
[RelationType.FRIEND]: '朋友',
[RelationType.COLLEAGUE]: '同事',
[RelationType.OTHER]: '其他'
};
return labels[relation] || '其他';
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/ContactsPage.ets#L472-L480 | 492d588ce57424a10ba3b3da029f12688b946fb1 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets | arkts | getPreviewProfile | [End Case2_start] | getPreviewProfile(cameraOutputCapability: camera.CameraOutputCapability): camera.Profile | undefined {
let previewProfiles: Array<camera.Profile> = cameraOutputCapability.previewProfiles;
if (previewProfiles.length < 1) {
return undefined;
}
let index: number = previewProfiles.findIndex((previewPr... | AST#method_declaration#Left getPreviewProfile AST#parameter_list#Left ( AST#parameter#Left cameraOutputCapability : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraOutputCapability AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p... | getPreviewProfile(cameraOutputCapability: camera.CameraOutputCapability): camera.Profile | undefined {
let previewProfiles: Array<camera.Profile> = cameraOutputCapability.previewProfiles;
if (previewProfiles.length < 1) {
return undefined;
}
let index: number = previewProfiles.findIndex((previewPr... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L101-L115 | 68bc76a1b58166c5832315686b835fed6c8dfe13 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | setTimeOut | 设置超时时间
@param timeout | setTimeOut(timeout: efRcpConfig.timeout): EfRcp {
if (timeout && this.cfg.requestConfiguration?.transfer) {
//允许建立连接的最长时间
if (timeout.connectMs && this.cfg.requestConfiguration.transfer.timeout) {
this.cfg.requestConfiguration.transfer.timeout.connectMs = timeout.connectMs;
}
//允许传输数... | AST#method_declaration#Left setTimeOut AST#parameter_list#Left ( AST#parameter#Left timeout : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . timeout AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a... | setTimeOut(timeout: efRcpConfig.timeout): EfRcp {
if (timeout && this.cfg.requestConfiguration?.transfer) {
if (timeout.connectMs && this.cfg.requestConfiguration.transfer.timeout) {
this.cfg.requestConfiguration.transfer.timeout.connectMs = timeout.connectMs;
}
if (timeout.t... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L277-L289 | 3c10d69e8b0a7fbef15905c377c5073730dda602 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextToSpeechHelper.ets | arkts | createEngine | TextToSpeechEngine实例
创建TextToSpeechEngine实例,并初始化引擎。
@param params 创建引擎实例的配置项
@returns | static async createEngine(params?: textToSpeech.CreateEngineParams):Promise<textToSpeech.TextToSpeechEngine> {
if (params === undefined || params === null) {
const createEngineParams: textToSpeech.CreateEngineParams = {
language: 'zh-CN', //语种,当前仅支持中文,推荐使用“zh-CN”格式,兼容“zh_CN”格式。
online: 1, //模式... | AST#method_declaration#Left static async createEngine AST#parameter_list#Left ( AST#parameter#Left params ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left textToSpeech . CreateEngineParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#param... | static async createEngine(params?: textToSpeech.CreateEngineParams):Promise<textToSpeech.TextToSpeechEngine> {
if (params === undefined || params === null) {
const createEngineParams: textToSpeech.CreateEngineParams = {
language: 'zh-CN',
online: 1,
person: 0,
extraParams: {... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextToSpeechHelper.ets#L11-L28 | 444e45be5976ac974f616d64d272f50278d5bf7c | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/card/detail/DetailCardsView.ets | arkts | openTestStart | 打开QuizStart | openTestStart(){
QuizManager.shared.quizType = QuizType.Custom
QuizManager.shared.customWords = this.words
QuizStartViewConfig.open()
} | AST#method_declaration#Left openTestStart AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left QuizManager AST#e... | openTestStart(){
QuizManager.shared.quizType = QuizType.Custom
QuizManager.shared.customWords = this.words
QuizStartViewConfig.open()
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detail/DetailCardsView.ets#L381-L385 | e12476994dfa434952f30e0b3e20f97728f5afb2 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | resetXY | 初始化 X Y | resetXY(): void {
this.positionY = -this.circleRadius
this.positionX = this.getAutoPositionX(0)
this.oldPositionX = 0
this.oldPositionY = 0
} | AST#method_declaration#Left resetXY 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_exp... | resetXY(): void {
this.positionY = -this.circleRadius
this.positionX = this.getAutoPositionX(0)
this.oldPositionX = 0
this.oldPositionY = 0
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L119-L124 | 3b85748fe34c6ccf4879325947ac319301e42624 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ReviewUtils.ets | arkts | 应用市场工具类
提供拉起应用市场写评论页面的功能 | export class ReviewUtils {
private static readonly TAG: string = 'ReviewUtils';
static reviewThisApp(){
ReviewUtils.openReviewPageByAppLink(getAppContext() as common.UIAbilityContext , ReviewUtils.getCurrentBundleName())
}
/**
* 通过Deep Linking方式拉起应用市场写评论页
* @param context - UIAbility上下文
* @par... | AST#export_declaration#Left export AST#class_declaration#Left class ReviewUtils AST#class_body#Left { AST#property_declaration#Left private static readonly TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'ReviewUtils' AST#expression#Righ... | export class ReviewUtils {
private static readonly TAG: string = 'ReviewUtils';
static reviewThisApp(){
ReviewUtils.openReviewPageByAppLink(getAppContext() as common.UIAbilityContext , ReviewUtils.getCurrentBundleName())
}
static openReviewPageByDeepLink(context: common.UIAbilityContext, bundleName:... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ReviewUtils.ets#L14-L136 | a17c2a95ef6ee596ee4006d9452ce8a3e41427a1 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/stepper/template1/Index.ets | arkts | itemStyle | 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... | @Styles function itemStyle () {
.width(336)
.height(621)
.margin({ top: 48, left: 12 })
.borderRadius(24)
.backgroundColor('#FFFFFF')
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function itemStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 336 AST#expression#Right ) AST#modifier_chain_expression#Left .... | @Styles function itemStyle () {
.width(336)
.height(621)
.margin({ top: 48, left: 12 })
.borderRadius(24)
.backgroundColor('#FFFFFF')
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/stepper/template1/Index.ets#L15-L21 | 75fe79279befdabad0a379a3bfc8fa6badf331c7 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/CustomDialog.ets | arkts | @Author csx
@DateTime 2024/6/11 12:37:06
@TODO CustomDialog 高级组件自定义弹框工具类
参考链接 https://developer.huawei.com/consumer/cn/forum/topic/0201150581656599021 | export class CustomDialog {
//完善弹框 参考https://gitee.com/harmonyos_samples/custom-dialog-gathers
//https://gitee.com/harmonyos_samples/component-collection
} | AST#export_declaration#Left export AST#class_declaration#Left class CustomDialog AST#class_body#Left { //完善弹框 参考https://gitee.com/harmonyos_samples/custom-dialog-gathers //https://gitee.com/harmonyos_samples/component-collection } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export class CustomDialog {
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/CustomDialog.ets#L23-L28 | d005728e75d319d13fa56928484946f4730fd114 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/expression/special_expression/not_null_002_F.ets | arkts | Introduction 非空断言操作符 | export function not_null_002_F(taint_src : string) {
let _t = taint_src;
let a = new A("_");
taint.Sink(a!.data);
} | AST#export_declaration#Left export AST#function_declaration#Left function not_null_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_statement#Left... | export function not_null_002_F(taint_src : string) {
let _t = taint_src;
let a = new A("_");
taint.Sink(a!.data);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/not_null_002_F.ets#L6-L10 | d2a445cad8dc691868822759746b7d04af9c724b | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | 动作类型枚举 | export enum ActionType {
VIEW = 'view',
LIKE = 'like',
SHARE = 'share',
PURCHASE = 'purchase',
SAVE = 'save',
CLICK = 'click',
SEARCH = 'search',
RATING = 'rating',
COMMENT = 'comment',
BOOKMARK = 'bookmark'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum ActionType AST#enum_body#Left { AST#enum_member#Left VIEW = AST#expression#Left 'view' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LIKE = AST#expression#Left 'like' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left S... | export enum ActionType {
VIEW = 'view',
LIKE = 'like',
SHARE = 'share',
PURCHASE = 'purchase',
SAVE = 'save',
CLICK = 'click',
SEARCH = 'search',
RATING = 'rating',
COMMENT = 'comment',
BOOKMARK = 'bookmark'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L94-L105 | 248505f958b5aa065f634e1a62b20af82c4429d7 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/ArrayUtil.ets | arkts | isNotEmpty | 集合是否为空集合,不空为true否则false
@param array
@returns | static isNotEmpty<T>(array: T[]): boolean {
return null != array && array.length != 0;
} | AST#method_declaration#Left static isNotEmpty AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Righ... | static isNotEmpty<T>(array: T[]): boolean {
return null != array && array.length != 0;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/ArrayUtil.ets#L41-L43 | 573c8900468b7ea81b4f2feef883b306e339364f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/data/DataImportExportService.ets | arkts | parseFileContent | 解析文件内容 | private async parseFileContent(content: string, filePath: string): Promise<Contact[]> {
try {
const extension = filePath.split('.').pop()?.toLowerCase();
switch (extension) {
case 'json':
return this.parseJSONContent(content);
case 'csv':
return this.parseCSVContent(... | AST#method_declaration#Left private async parseFileContent AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left stri... | private async parseFileContent(content: string, filePath: string): Promise<Contact[]> {
try {
const extension = filePath.split('.').pop()?.toLowerCase();
switch (extension) {
case 'json':
return this.parseJSONContent(content);
case 'csv':
return this.parseCSVContent(... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L623-L637 | 795daaf177ff542bfe9aa398af4e07068bf377d9 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets | arkts | hmac | 消息认证码计算
@param str 计算字符串
@param symAlgName 秘钥规格
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns | static hmac(str: string, symAlgName: string,
resultCoding: buffer.BufferEncoding = 'base64'): string {
//创建消息认证码计算器
let mac = crypto.createMac(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200; // 默认以200字节为单位进行分段update
let symKeyGenerator = c... | AST#method_declaration#Left static hmac AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R... | static hmac(str: string, symAlgName: string,
resultCoding: buffer.BufferEncoding = 'base64'): string {
let mac = crypto.createMac(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200;
let symKeyGenerator = crypto.createSymKeyGenerator('AES256'... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets#L84-L102 | c6c7d6f3ed79deaaf19d9dbdaa487a010ddde010 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | setupDefaultFormatter | Calculates the required number of digits for the values that might be
drawn in the chart (if enabled), and creates the default-value-formatter | protected setupDefaultFormatter(min: number, max: number) {
let reference: number = 0;
if (this.mData == null || this.mData.getEntryCount() < 2) {
reference = Math.max(Math.abs(min), Math.abs(max));
} else {
reference = Math.abs(max - min);
}
let digits: number = Utils.getDecimals(re... | AST#method_declaration#Left protected setupDefaultFormatter AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#p... | protected setupDefaultFormatter(min: number, max: number) {
let reference: number = 0;
if (this.mData == null || this.mData.getEntryCount() < 2) {
reference = Math.max(Math.abs(min), Math.abs(max));
} else {
reference = Math.abs(max - min);
}
let digits: number = Utils.getDecimals(re... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L327-L342 | d93728173f0cd9ac28e89a6deab2498dded9242a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets | arkts | rgb2hsv | RGB transform to HSV.
@param red 0- 255.
@param green 0- 255.
@param blue 0- 255.
@return h (0 - 360) s(0 - 100) v (0 - 100). | function rgb2hsv(red: number, green: number, blue: number): HSV {
let hsvH: number = 0, hsvS: number = 0, hsvV: number = 0;
const rgbR: number = colorTransform(red);
const rgbG: number = colorTransform(green);
const rgbB: number = colorTransform(blue);
const maxValue: number = Math.max(rgbR, Math.max(rgbG, rg... | AST#function_declaration#Left function rgb2hsv AST#parameter_list#Left ( AST#parameter#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left green : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | function rgb2hsv(red: number, green: number, blue: number): HSV {
let hsvH: number = 0, hsvS: number = 0, hsvV: number = 0;
const rgbR: number = colorTransform(red);
const rgbG: number = colorTransform(green);
const rgbB: number = colorTransform(blue);
const maxValue: number = Math.max(rgbR, Math.max(rgbG, rg... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/PixelUtil.ets#L52-L81 | c82611b9ba576c0b6e761deb5cab393bb37e2121 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | initializeAI | 私有方法
初始化AI | private async initializeAI(): Promise<void> {
try {
// TODO: 初始化AI模型
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'AI model initialized');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize AI: ${error}`);
}
} | AST#method_declaration#Left private async initializeAI AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#... | private async initializeAI(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'AI model initialized');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize AI: ${error}`);
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L530-L537 | dc5a7b30d64f768980b279a9fcd5218f31cc4035 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BarLineScatterCandleBubbleDataSet.ets | arkts | setHighLightColor | Sets the color that is used for drawing the highlight indicators. Dont
forget to resolve the color using ColorTemplate.colorRgb(...) or Color.Xxx or
ChartColor.rgb(...).
@param color | public setHighLightColor(color: number): void {
this.mHighLightColor = color;
} | AST#method_declaration#Left public setHighLightColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar... | public setHighLightColor(color: number): void {
this.mHighLightColor = color;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarLineScatterCandleBubbleDataSet.ets#L42-L44 | 16272a244bda9b89af24dff4b1151ad6531fe01f | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Spacer.ets | arkts | SpaceVerticalLarge | 创建一个大垂直间距(16vp)
@returns {void} 无返回值 | @Builder
export function SpaceVerticalLarge(): void {
Blank().height($r("app.float.space_vertical_large"));
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalLarge AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts... | @Builder
export function SpaceVerticalLarge(): void {
Blank().height($r("app.float.space_vertical_large"));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L28-L31 | 043cee75ddb0c57f0c6c112860a9d291c03d48ef | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 备份配置接口 | export interface BackupConfig {
enabled: boolean;
frequency: BackupFrequency;
location: BackupLocation;
maxBackups: number;
includeImages: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BackupConfig 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 frequency : AST#type_annotat... | export interface BackupConfig {
enabled: boolean;
frequency: BackupFrequency;
location: BackupLocation;
maxBackups: number;
includeImages: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L290-L296 | 327e9112b4b3b4fa685a7e55a43bf2e9603cef5a | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/component/ListItemComponent.ets | arkts | ListItemComponent | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ListItemComponent {
private title: string | Resource = '';
private endText: string | Resource = '';
private endArrowIsShow: boolean = false;
aboutToAppear() {
if (this.endText === 'true') {
this.endText = $r('app.string.Yes')
} else if (this.endText === 'false') {
t... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemComponent 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 Resour... | @Component
export struct ListItemComponent {
private title: string | Resource = '';
private endText: string | Resource = '';
private endArrowIsShow: boolean = false;
aboutToAppear() {
if (this.endText === 'true') {
this.endText = $r('app.string.Yes')
} else if (this.endText === 'false') {
t... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/component/ListItemComponent.ets#L16-L53 | dfb02228af6bdc2f905068d7b4729b757d51f0e8 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/MeViewModel.ets | arkts | @file 我的页面 ViewModel
@author Joker.X | @ObservedV2
export default class MeViewModel extends BaseViewModel {
/**
* 全局用户状态
*/
private readonly userState: UserState = getUserState();
/**
* 订单仓库
*/
private readonly orderRepository: OrderRepository = new OrderRepository();
/**
* 订单统计
*/
@Trace
orderCount: OrderCount = new OrderCou... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class MeViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* 全局用户状态
*/ AST#prop... | @ObservedV2
export default class MeViewModel extends BaseViewModel {
private readonly userState: UserState = getUserState();
private readonly orderRepository: OrderRepository = new OrderRepository();
@Trace
orderCount: OrderCount = new OrderCount();
@Trace
recentFootprints: Footprint[] = [];
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MeViewModel.ets#L19-L118 | 0335ef2072cbf36fcf318d2720e100dbb0217bb7 | github | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | pushData | 插入数据函数
@param data | public pushData(data: ChatMessage): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ChatMessage 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_typ... | public pushData(data: ChatMessage): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L36-L39 | 344998f3f4c53b4f6140a7041e0f5fad44b59b59 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.