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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/LunarService.ets | arkts | getMonthName | 获取月份名称 | private getMonthName(month: number, isLeapMonth: boolean): string {
return LunarUtils.getMonthName(month, isLeapMonth);
} | AST#method_declaration#Left private getMonthName AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : AST#type_annotation#Left AST#primary_type#Left boolean AST#p... | private getMonthName(month: number, isLeapMonth: boolean): string {
return LunarUtils.getMonthName(month, isLeapMonth);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L644-L646 | 6c5f649a1303008f1643072e948a8bf210b668e1 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/readStatistics.ets | arkts | deleteList | 删除列表 | deleteList(){
this.clearInfoDel?.open()
} | AST#method_declaration#Left deleteList 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#member_expression#Left AST#expression#Left this A... | deleteList(){
this.clearInfoDel?.open()
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/readStatistics.ets#L124-L126 | 57d80756017fe2503ef5a470dd1446e1583eb9d7 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/LocationUtil.ets | arkts | getCountryCode | 获取当前的国家码-无需申请定位权限
@returns 返回当前位置中文描述 | static async getCountryCode(): Promise<string> {
//获取当前的国家码
let result = await geoLocationManager.getCountryCode();
if (result.country) {
return result.country;
}
return '未获取到获取当前国家码信息~';
} | AST#method_declaration#Left static async getCountryCode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > A... | static async getCountryCode(): Promise<string> {
let result = await geoLocationManager.getCountryCode();
if (result.country) {
return result.country;
}
return '未获取到获取当前国家码信息~';
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/LocationUtil.ets#L127-L134 | d7af0e68947fd703819948085dbe99e6fb14395d | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/ResPath.ets | arkts | 封面图片资源定义类
对应 Kotlin object Img | export class ResImg {
// 洪恩
/**
* 获取所有封面图片资源
*/
static get allImages(): ResPath[] {
return [
]
}
} | AST#export_declaration#Left export AST#class_declaration#Left class ResImg AST#class_body#Left { // 洪恩 /**
* 获取所有封面图片资源
*/ AST#method_declaration#Left static get AST#ERROR#Left all Image s AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#arr... | export class ResImg {
static get allImages(): ResPath[] {
return [
]
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/ResPath.ets#L83-L95 | 11987d6e3f7414e7734a0d19dfc1d705a1630f36 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/dbUtils/ResultSetTool.ets | arkts | getDate | /获得日期 | static getDate(rs: relationalStore.ResultSet, colName: string): Date | null {
return new Date(rs.getString(rs.getColumnIndex(colName)));
} | AST#method_declaration#Left static getDate AST#parameter_list#Left ( AST#parameter#Left rs : 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 colName : AST... | static getDate(rs: relationalStore.ResultSet, colName: string): Date | null {
return new Date(rs.getString(rs.getColumnIndex(colName)));
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/ResultSetTool.ets#L17-L19 | 6abc3bf8e2863a76443b0d0b3f6118b1095fd745 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/style/ILinearGradient.ets | arkts | 【系统】渐变参数定义
@author pll
@create 2025-06-04 14:25 | export interface ILinearGradient {
angle?: number | string;
direction?: GradientDirection;
colors: Array<[
ResourceColor,
number
]>;
repeating?: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ILinearGradient AST#object_type#Left { AST#type_member#Left angle ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AS... | export interface ILinearGradient {
angle?: number | string;
direction?: GradientDirection;
colors: Array<[
ResourceColor,
number
]>;
repeating?: boolean;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/ILinearGradient.ets#L6-L14 | da639bcc8e854432995159f91d260ab15f595833 | github | |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/MainViewModel.ets | arkts | Binds data to components and provides interfaces. | export class MainViewModel {
/**
* Get data of the first grid.
*
* @return {Array<PageResource>} firstGridData.
*/
firstGridData: ItemData[] = [
new ItemData(0, $r('app.string.my_love'), $r('app.media.love')),
new ItemData(2, $r('app.string.message'), $r('app.media.message')),
new ... | AST#export_declaration#Left export AST#class_declaration#Left class MainViewModel AST#class_body#Left { /**
* Get data of the first grid.
*
* @return {Array<PageResource>} firstGridData.
*/ AST#property_declaration#Left firstGridData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ItemD... | export class MainViewModel {
firstGridData: ItemData[] = [
new ItemData(0, $r('app.string.my_love'), $r('app.media.love')),
new ItemData(2, $r('app.string.message'), $r('app.media.message')),
new ItemData(3, $r('app.string.shopping_cart'), $r('app.media.shopping')),
new ItemData(5, $r('... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/MainViewModel.ets#L8-L22 | 00f4dad9a42d6d71ae75e9f55452838fb51b540b | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pendingitems/src/main/ets/model/ConstData.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export const STYLE_CONFIG: Record<string, number> = {
'IMAGE_MARGIN': 4,
'ICON_GUTTER': 4,
'OPERATION_BUTTON_PADDING': 4,
'MENU_IMAGE_SIZE': 24,
'MENU_HEIGHT': 56,
'TEXT_MARGIN_LEFT': 40,
'IMAGE_MARGIN_RIGHT': 30,
'LIST_ITEM_GUTTER': 12,
'BORDER_WIDTH': 3,
'TODO_ITEM_HEIGHT': 80,
'TODO_ITEM_PADDIN... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left STYLE_CONFIG : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ... | export const STYLE_CONFIG: Record<string, number> = {
'IMAGE_MARGIN': 4,
'ICON_GUTTER': 4,
'OPERATION_BUTTON_PADDING': 4,
'MENU_IMAGE_SIZE': 24,
'MENU_HEIGHT': 56,
'TEXT_MARGIN_LEFT': 40,
'IMAGE_MARGIN_RIGHT': 30,
'LIST_ITEM_GUTTER': 12,
'BORDER_WIDTH': 3,
'TODO_ITEM_HEIGHT': 80,
'TODO_ITEM_PADDIN... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pendingitems/src/main/ets/model/ConstData.ets#L16-L34 | e679086ce45bdc5bef44bd516a4bfa01aa66f54d | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/component/LottieView.ets | arkts | LottieBuilder | Lottie加载动画 | @Builder
export function LottieBuilder(options: LoadOptions) {
LottieView({ options: options })
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LottieBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left LoadOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list... | @Builder
export function LottieBuilder(options: LoadOptions) {
LottieView({ options: options })
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/LottieView.ets#L7-L10 | c93b03f81a3a693902f6b825c6bfdfbf5dc00407 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/model/NewsItemModel.ets | arkts | 视频信息,包括标题、视频地址、首帧图片、视频详情 | export class NewsItem {
newsName: string; // 标题
newsVideoSrc: string; // 视频地址
newsImage: ResourceStr; // 首帧图片
newsDetails: ResourceStr; // 详情
constructor(newsName: string, newsVideoSrc: string, newsImage: ResourceStr, newsDetails: ResourceStr) {
this.newsName = newsName;
this.newsVideoSrc = newsVideo... | AST#export_declaration#Left export AST#class_declaration#Left class NewsItem AST#class_body#Left { AST#property_declaration#Left newsName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 标题 AST#property_declaration#Left newsVide... | export class NewsItem {
newsName: string;
newsVideoSrc: string;
newsImage: ResourceStr;
newsDetails: ResourceStr;
constructor(newsName: string, newsVideoSrc: string, newsImage: ResourceStr, newsDetails: ResourceStr) {
this.newsName = newsName;
this.newsVideoSrc = newsVideoSrc;
this.newsImage ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/model/NewsItemModel.ets#L19-L31 | ea3749ea538911eeab3adc88d2a705c5d05b8e38 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/main/sub/report/RadarView.ets | arkts | buildLegend | ========== 图例区域构建器 ========== | @Builder
buildLegend() {
Column({ space: 8 }) {
ForEach(this.parts, (part: ChartPart, index?: number) => {
Row({ space: 8 }) {
// 颜色标识
Rect()
.width(12)
.height(12)
.backgroundColor(part.color)
.borderRadius(2)
// 文本信息
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildLegend 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_paramet... | @Builder
buildLegend() {
Column({ space: 8 }) {
ForEach(this.parts, (part: ChartPart, index?: number) => {
Row({ space: 8 }) {
Rect()
.width(12)
.height(12)
.backgroundColor(part.color)
.borderRadius(2)
Colum... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L76-L116 | 3deacadc4ae9f9934a5c59dca6c33fdc667b7239 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusController.ets | arkts | FocusControl | [Start dynamic_focus_control_demo] | @Entry
@Component
export struct FocusControl {
@State btColor: string = '#ff2787d9';
@State btColor2: string = '#ff2787d9';
build() {
NavDestination() {
Column({ space: 12 }) {
Column({ space: 20 }) {
Column({ space: 5 }) {
Button('Button')
.width(200)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FocusControl AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right btColor : AST#type_annotation#Left AST#primary_type#Le... | @Entry
@Component
export struct FocusControl {
@State btColor: string = '#ff2787d9';
@State btColor2: string = '#ff2787d9';
build() {
NavDestination() {
Column({ space: 12 }) {
Column({ space: 20 }) {
Column({ space: 5 }) {
Button('Button')
.width(200)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/FocusController.ets#L20-L99 | 88c8000837353fe92a5636c2bd961ad785138dd9 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/LanguageDetector.ets | arkts | 语言使用记录接口 | export interface LanguageUsageRecord {
language: SupportedLanguage;
timestamp: string;
duration: number; // 使用时长(分钟)
source: DetectionSource;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LanguageUsageRecord AST#object_type#Left { AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left timestamp ... | export interface LanguageUsageRecord {
language: SupportedLanguage;
timestamp: string;
duration: number;
source: DetectionSource;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L47-L52 | 4fe7eee46b0292aca00ea3db138e31d93a11672a | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets | arkts | getContext | 获取上下文信息
@returns | getContext(): common.UIAbilityContext {
return this.objects.get(CONTEXT_STR) as common.UIAbilityContext;
} | AST#method_declaration#Left getContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#retur... | getContext(): common.UIAbilityContext {
return this.objects.get(CONTEXT_STR) as common.UIAbilityContext;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/model/GlobalProxyServer.ets#L37-L39 | f24338914cfbd8ec5c3655818a1844e5512fcdbb | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getOsReleaseType | 获取系统的发布类型,取值为:Canary、Beta、Release | static getOsReleaseType(): string {
return deviceInfo.osReleaseType;
} | AST#method_declaration#Left static getOsReleaseType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_... | static getOsReleaseType(): string {
return deviceInfo.osReleaseType;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L238-L240 | cfccddd064274773b72193defd996c34bd53c375 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/common/constants/Constants.ets | arkts | Background color array. | export const BG_COLOR_ARRAY: string[] = ['#FFFFFF', '#FDEAD3', '#DFF7E5', '#DFF1FA']; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BG_COLOR_ARRAY : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expr... | export const BG_COLOR_ARRAY: string[] = ['#FFFFFF', '#FDEAD3', '#DFF7E5', '#DFF1FA']; | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/common/constants/Constants.ets#L191-L191 | 0930ffef6f8e44a437b35424a3e8ce7a12b07b08 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DateUtils.ets | arkts | addHours | 增加小时
@param date 基准日期
@param hoursToAdd 增加的小时数
@returns 新日期对象 | static addHours(date: Date, hoursToAdd: number): Date {
return new Date(date.getTime() + hoursToAdd * 3600000); // 60 * 60 * 1000
} | AST#method_declaration#Left static addHours AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left hoursToAdd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ... | static addHours(date: Date, hoursToAdd: number): Date {
return new Date(date.getTime() + hoursToAdd * 3600000);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L82-L84 | 72351956026a106a361893fbcf3109f50c2a826c | github |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 清空未读请求参数 | export interface ClearUnreadParams {
myId: string;
friendId: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ClearUnreadParams AST#object_type#Left { AST#type_member#Left myId : 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 friendId : AST#type_annotat... | export interface ClearUnreadParams {
myId: string;
friendId: string;
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L200-L203 | c7a78063decc94a92482e3221938dbec784de744 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/model/src/main/ets/network/NetworkPageMeta.ets | arkts | @file 分页元数据模型
@author Joker.X | export class NetworkPageMeta {
/**
* 总条数
*/
total: number | null;
/**
* 每页显示条数
*/
size: number | null;
/**
* 当前页码
*/
page: number | null;
/**
* 构造函数,对接口返回做空值兜底
* @param {Partial<NetworkPageMeta>} payload - 接口返回的分页数据
*/
constructor(payload?: Partial<NetworkPageMeta>) {
thi... | AST#export_declaration#Left export AST#class_declaration#Left class NetworkPageMeta AST#class_body#Left { /**
* 总条数
*/ AST#property_declaration#Left total : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#unio... | export class NetworkPageMeta {
total: number | null;
size: number | null;
page: number | null;
constructor(payload?: Partial<NetworkPageMeta>) {
this.total = payload?.total ?? null;
this.size = payload?.size ?? null;
this.page = payload?.page ?? null;
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/network/NetworkPageMeta.ets#L5-L28 | c6c7959146dedbacc6953fc906d1f74d7a06cb81 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/highlight/BarHighlighter.ets | arkts | getDistance | /** * Splits up the stack-values of the given bar-entry into Range objects. * * @param entry * @return protected Range[] getRanges(BarEntry entry) { float[] values = entry.getYVals(); if (values == null || values.length == 0) return new Range[0]; Range[] ranges = new Range[values.length]; float negRemain = -entry.... | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
return Math.abs(x1 - x2);
} | AST#method_declaration#Left protected getDistance AST#parameter_list#Left ( AST#parameter#Left x1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | protected getDistance(x1: number, y1: number, x2: number, y2: number): number {
return Math.abs(x1 - x2);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/BarHighlighter.ets#L169-L171 | 30612a0a4e8932b72372da06345adbd070da355a | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/card/Card.ets | arkts | 构建卡片视图
@returns {void} 无返回值 | build(): void {
Column() {
if (this.content) {
this.content();
}
}
.width(this.widthValue)
.height(this.heightValue)
.padding(this.paddingValue)
.backgroundColor(this.bgColor)
.borderRadius(this.radiusValue)
.onClick((): void => this.onTap());
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_... | build(): void {
Column() {
if (this.content) {
this.content();
}
}
.width(this.widthValue)
.height(this.heightValue)
.padding(this.paddingValue)
.backgroundColor(this.bgColor)
.borderRadius(this.radiusValue)
.onClick((): void => this.onTap());
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/card/Card.ets#L51-L63 | 0c093469dca79b75f022c51f1c38fc58801d1035 | github | |
charon2pluto/MoodDiary-HarmonyOS.git | 0ec7ee6861e150bc9b4571062dbf302d1b106b8c | entry/src/main/ets/pages/MoodHistory.ets | arkts | applyFilter | ★ 核心逻辑:执行筛选 | applyFilter() {
if (this.searchText.trim() === '') {
this.filteredList = this.historyList;
} else {
const keyword = this.searchText.toLowerCase();
this.filteredList = this.historyList.filter(item =>
// 搜索范围:原因文字 或 日记正文
item.reason.toLowerCase().includes(keyword) ||
item.diary... | AST#method_declaration#Left applyFilter AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left ... | applyFilter() {
if (this.searchText.trim() === '') {
this.filteredList = this.historyList;
} else {
const keyword = this.searchText.toLowerCase();
this.filteredList = this.historyList.filter(item =>
item.reason.toLowerCase().includes(keyword) ||
item.diaryContent.toLowerCase... | https://github.com/charon2pluto/MoodDiary-HarmonyOS.git/blob/0ec7ee6861e150bc9b4571062dbf302d1b106b8c/entry/src/main/ets/pages/MoodHistory.ets#L40-L51 | 9817d97abbc41357d124b8dbc677984bbac71283 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets | arkts | [Start power_entry_ability] | export default class EntryAbility extends UIAbility {
// [StartExclude power_entry_ability]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (error) {
hilog.... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // [StartExclude power_entry_ability] AST#method_declaration#Left onCreate AST#parameter_list#L... | export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
try {
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
} catch (error) {
hilog.info(DOMAIN, 'testTag', '%{public}s',... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LowPowerOfForegroundTask/entry/src/main/ets/entryability/EntryAbility.ets#L8-L69 | 9f3358208c78dd4a99d4a89376230b612058789c | gitee | |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/types/player.ets | arkts | 玩家类型声明 | export interface TAchiveItem {
name: string
count: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TAchiveItem AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left count : AST#type_annotation#Left AS... | export interface TAchiveItem {
name: string
count: number
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/player.ets#L4-L7 | 0bfcecb2f26885fe870681b86a700b221336b42d | github | |
LumenVestige/HarmonyHelloWorldApp.git | 84189de8d36a9869b353e62f71cec95c5420e763 | commons/utils/src/main/ets/common/CommonConstants.ets | arkts | Common constants for common component. | export class CommonConstants {
// font family
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
static readonly HARMONY_HEITI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium';
static readonly HARMONY_HEITI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold';
// font weight
static readonly DIALOG_TITLE_FONT_WEIGHT: ... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // font family AST#property_declaration#Left static readonly HARMONY_HEI_TI_FONT_FAMILY = AST#expression#Left 'HarmonyHeiTi' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left stati... | export class CommonConstants {
static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
static readonly HARMONY_HEITI_MEDIUM_FONT_FAMILY = 'HarmonyHeiTi-Medium';
static readonly HARMONY_HEITI_BOLD_FONT_FAMILY = 'HarmonyHeiTi-Bold';
static readonly DIALOG_TITLE_FONT_WEIGHT: number = 700;
static reado... | https://github.com/LumenVestige/HarmonyHelloWorldApp.git/blob/84189de8d36a9869b353e62f71cec95c5420e763/commons/utils/src/main/ets/common/CommonConstants.ets#L19-L66 | 532c0277f6fe5938b739d7cbfad31bd0c592eb5b | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | aboutToDisappear | 页面隐藏时清理计时器
@returns {void} 无返回值 | aboutToDisappear(): void {
this.clearSideBarUnlockTimer();
} | AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | aboutToDisappear(): void {
this.clearSideBarUnlockTimer();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L180-L182 | a20e190a82ea6dca97df403df12a104235ea54b6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/VoiceService.ets | arkts | speakText | 语音合成播放文本 | async speakText(text: string, config?: Partial<TTSConfig>): Promise<void> {
if (!this.ttsEngine) {
throw new Error('TTS引擎未初始化');
}
try {
if (this.isSpeaking) {
await this.stopSpeaking();
}
const ttsConfig = { ...this.defaultTTSConfig, ...config };
// 设置TTS参数
aw... | AST#method_declaration#Left async speakText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async speakText(text: string, config?: Partial<TTSConfig>): Promise<void> {
if (!this.ttsEngine) {
throw new Error('TTS引擎未初始化');
}
try {
if (this.isSpeaking) {
await this.stopSpeaking();
}
const ttsConfig = { ...this.defaultTTSConfig, ...config };
await this.t... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L172-L197 | 38b0ac7f8c24e3023ab86b5cfc11a9903e0cff8d | github |
supermanaaaa/HarmonyOS-Next-Knowledge-Base.git | a818e59f200ebf4cae00bc634a6c04b9486b8a8f | HarmonyOSNextKnowledgeLearning/DevEco Studio/Design and Implementation of Active Image Caching Based on HarmonyOS 5 Ability Image Component/ImageReloadComponent.ets | arkts | downloadImageToCache | 下载网络图片到缓存中,返回最终的本地文件路径(带 file:// 前缀) | public abstract downloadImageToCache(
urlLink: string,
onStartDownload?: () => void,
onEndDownload?: () => void
): Promise<string>; | AST#method_declaration#Left public abstract downloadImageToCache AST#parameter_list#Left ( AST#parameter#Left urlLink : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onStartDownload ? : AST#type_annotation#Left AST#functio... | public abstract downloadImageToCache(
urlLink: string,
onStartDownload?: () => void,
onEndDownload?: () => void
): Promise<string>; | https://github.com/supermanaaaa/HarmonyOS-Next-Knowledge-Base.git/blob/a818e59f200ebf4cae00bc634a6c04b9486b8a8f/HarmonyOSNextKnowledgeLearning/DevEco Studio/Design and Implementation of Active Image Caching Based on HarmonyOS 5 Ability Image Component/ImageReloadComponent.ets#L93-L97 | 8912d50cc857c380b5b14c3097ea83083549206c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets | arkts | articleTitleBuilder | 搜索框提示字 | @Builder
articleTitleBuilder() {
Text($r('app.string.status_bar_animation_beautiful_text'))
.fontWeight(FontWeight.Bold)
.fontFamily(Constants.HARMONY_HEI_TI_BOLD_FONT_FAMILY)
.fontSize($r('app.integer.status_bar_animation_beautiful_text_font'))
.width(Constants.FULL_PERCENT)
.height... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right articleTitleBuilder 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 Text ( AST#expression#Left AST#resource_expression#Lef... | @Builder
articleTitleBuilder() {
Text($r('app.string.status_bar_animation_beautiful_text'))
.fontWeight(FontWeight.Bold)
.fontFamily(Constants.HARMONY_HEI_TI_BOLD_FONT_FAMILY)
.fontSize($r('app.integer.status_bar_animation_beautiful_text_font'))
.width(Constants.FULL_PERCENT)
.height... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets#L86-L99 | da4f71fee20fe077da72c7b5621c445fd31d70d1 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | setSelectedShowDate | 初始化数据 public initData() { let dateStr:string = dateToStr(new Date(this.showDate)); let filteredItems = this.dateArr.filter(item => item.dateStr === dateStr); let selectedDayInfo = filteredItems.length > 0 ? filteredItems[0] : undefined; if (!selectedDayInfo) { AccountingInfoApi.query(dateStr, (resultSet: AccountingIn... | public setSelectedShowDate(ShowDateTime: number) {
this.showDate = ShowDateTime;
this.dateTitle = weekDateFormat(this.showDate);
// let selectedDayInfo = this.dateArr.find((item: WeekDateModel) => item.dateStr == dateToStr(new Date(ShowDateTime))) as WeekDateModel;
let filteredItems = this.dateArr.filte... | AST#method_declaration#Left public setSelectedShowDate AST#parameter_list#Left ( AST#parameter#Left ShowDateTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme... | public setSelectedShowDate(ShowDateTime: number) {
this.showDate = ShowDateTime;
this.dateTitle = weekDateFormat(this.showDate);
let filteredItems = this.dateArr.filter(item => item.dateStr === dateToStr(new Date(ShowDateTime)));
let selectedDayInfo = filteredItems.length > 0 ? filteredItems[0] : u... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L133-L157 | ffdfcc37815c8a9c397bc583340473bff08e3738 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/base/OutDTO.ets | arkts | @Author csx
@DateTime 2023/12/29 22:45
@TODO OutDTO 输出对象
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_core | export class OutDTO<T> {
//成功失败标识
private success: boolean;
//返回提示信息
private msg: string;
//响应编码
private code: string | number;
//返回单行数据
private dataRow: T;
//返回数据集合
private dataTable: Array<T>;
/**
* 构造函数
* @param success 是否成功标识
* @param msg 提示消息
* @param dataRow 单行数据
* @param... | AST#export_declaration#Left export AST#class_declaration#Left class OutDTO AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { //成功失败标识 AST#property_declaration#Left private success : AST#type_annotation#Left AST#primary_type#Left boolean AST#p... | export class OutDTO<T> {
private success: boolean;
private msg: string;
private code: string | number;
private dataRow: T;
private dataTable: Array<T>;
constructor(success: boolean, msg: string, dataRow: T, dataTable: Array<T>, code: string | number) {
this.msg = msg;
this.success... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/base/OutDTO.ets#L23-L156 | 0d94487599e6cd01dc0ecd4f1b53034fc985cf5f | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets | arkts | PageTurningAnimationComponent | 功能描述: 翻页动效是应用开发中常见的动效场景,常见的有书籍翻页,日历翻页等。本例将介绍如何通过ArkUI提供的显示动画接口animateTo实现翻页的效果。
推荐场景: 翻页动效
核心组件:
1. pageTurningAnimate()
实现步骤:
1. 创建文本组件。创建时添加rotate属性,用来控制组件旋转。由于各组件旋转的角度和旋转中心不同,
需要父组件在调用时传入对应的参数,所以为对应变量添加@Prop装饰器,用来控制变量传递。
2. 创建父组件框架。由于文本组件分为上下两层,所以在父组件中采用Stack组件进行层叠布局。同时使用
Divider组件作为书籍两个页面间的分隔线。
3.添加翻页动效。在父组件中定义对... | @Component
export struct PageTurningAnimationComponent {
// 父组件变量设置,使用@State做状态管理
@State originalAngle: number = 0; // 初始角度
@State rotateAngleTextA: number = 0; // Text组件A的旋转角度
@State rotateAngleTextB: number = 0; // Text组件B的旋转角度
@State pageNumTextA: number = 0; // Text组件A的页面编号,用于刷新翻页动画结束时的页面编号
@State anima... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageTurningAnimationComponent AST#component_body#Left { // 父组件变量设置,使用@State做状态管理 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right originalAngle : AST#type_annotation#Left AST#primary_type#L... | @Component
export struct PageTurningAnimationComponent {
@State originalAngle: number = 0;
@State rotateAngleTextA: number = 0;
@State rotateAngleTextB: number = 0;
@State pageNumTextA: number = 0;
@State animatePageNumTextB: number = 1;
@State pageNumTextC: number = 0;
@State nextPageNumTextD: n... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets#L66-L163 | e7377d5a569af4694af98a1aef9562cc8b3d24b7 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | getDisplayNickName | 获取展示昵称
@returns {ResourceStr} 展示昵称 | getDisplayNickName(): ResourceStr {
const nickName: string = this.userState.getUserInfo().nickName?.trim() ?? "";
return nickName.length > 0 ? nickName : $r("app.string.user_profile_nickname_empty");
}
/**
* 获取展示用户 ID
* @returns {ResourceStr} 展示用户 ID
*/
getDisplayUserId(): ResourceStr {
cons... | AST#method_declaration#Left getDisplayNickName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left... | getDisplayNickName(): ResourceStr {
const nickName: string = this.userState.getUserInfo().nickName?.trim() ?? "";
return nickName.length > 0 ? nickName : $r("app.string.user_profile_nickname_empty");
}
getDisplayUserId(): ResourceStr {
const userId: number = this.userState.getUserInfo().id ?? 0;
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L20-L32 | 8f3c5a6a0444bbd0bde77bfaa37fb1003fac6639 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | createColorSystem | 创建颜色系统(支持深色模式) | private createColorSystem(primaryColor: string, isDark: boolean): ColorSystem {
if (isDark) {
// 深色模式颜色系统
return {
// 主品牌色
primary: primaryColor,
primaryHover: this.lightenColor(primaryColor, 0.2),
primaryLight: this.darkenColor(primaryColor, 0.7),
// 红色系 - 生日庆祝
... | AST#method_declaration#Left private createColorSystem AST#parameter_list#Left ( AST#parameter#Left primaryColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isDark : AST#type_annotation#Left AST#primary_type#Left boolea... | private createColorSystem(primaryColor: string, isDark: boolean): ColorSystem {
if (isDark) {
return {
primary: primaryColor,
primaryHover: this.lightenColor(primaryColor, 0.2),
primaryLight: this.darkenColor(primaryColor, 0.7),
redPrimary: '#FF6B6B',
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5884-L5994 | ec268d992e5cd0bac2b1f0783f8bff466adeb56e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/constants/Constants.ets | arkts | 通用常量 | export default class CommonConstants {
/**
* 首页图片宽度
*/
static readonly firstImageWidth = 762;
/**
* 首页图片高度
*/
static readonly firstImageHeight = 431;
/**
* 首页图片从视频中截取的开始时间
*/
static readonly FIRST_IMAGE_START_TIME = 1000;
/**
* 首页图片从视频中截取的结束时间
*/
static readonly FIRST_IMAGE_END_T... | AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* 首页图片宽度
*/ AST#property_declaration#Left static readonly firstImageWidth = AST#expression#Left 762 AST#expression#Right ; AST#property_declaration#Right /**
* 首页图片高度
*/ AST#property_declara... | export default class CommonConstants {
static readonly firstImageWidth = 762;
static readonly firstImageHeight = 431;
static readonly FIRST_IMAGE_START_TIME = 1000;
static readonly FIRST_IMAGE_END_TIME = 12000;
static readonly PROGRESS_MAX = 100;
static readonly UPLOAD_INTERVAL_TIME = 1000... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/constants/Constants.ets#L19-L56 | 6b10a6066e62ededb77a4f477d5afac1754d9295 | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets | arkts | encryptGCMSegment | 加密(GCM模式)分段,异步
@param dataBlob 加密或者解密的数据。dataBlob不能为null。
@param key 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param len 自定义的数据拆分长度。
@returns | static async encryptGCMSegment(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key,
gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_... | AST#method_declaration#Left static async encryptGCMSegment 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#paramet... | static async encryptGCMSegment(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key,
gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_... | 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/crypto/SM4.ets#L253-L270 | 8831964207d26297fa187104534710fb30fbc0f6 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/CharUtils.ets | arkts | 字符工具类 | export class CharUtils {
private constructor() {}
/**
* 是否空白符 空白符包括空格、制表符、全角空格和不间断空格
* @param c
* @returns
*/
static isBlankChar(c: number): boolean {
return CharUtils.isWhitespace(c)
|| CharUtils.isSpaceChar(c)
|| c == 0xFEFF
|| c == 0x202A
|| c == 0x0000;
}
/**
... | AST#export_declaration#Left export AST#class_declaration#Left class CharUtils AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right /**
* 是否空白符 空白符包括空格、制表... | export class CharUtils {
private constructor() {}
static isBlankChar(c: number): boolean {
return CharUtils.isWhitespace(c)
|| CharUtils.isSpaceChar(c)
|| c == 0xFEFF
|| c == 0x202A
|| c == 0x0000;
}
static isAscii(ch: string): boolean {
if (ch.length !== 1) throw n... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/CharUtils.ets#L4-L68 | 1dfc18608175a381b2d526a05e7135c52b4f0190 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/FileUtil.ets | arkts | getCacheDirPath | 获取缓存目录下的文件夹路径或文件路径。
@param dirPath 文件路径,支持完整路径 和 相对路径(download/wps/doc)。dirPath传空表示根目录
@param fileName 文件名(test.text)
@returns | static getCacheDirPath(dirPath: string, fileName?: string): string {
let filePath = getContext().cacheDir; //根目录
if (!StrUtil.isEmpty(dirPath)) {
if (FileUtil.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。
filePath = dirPath;
} else { //路径中不包含根目录,拼接成完整路径。
filePath = filePath + FileUtil.sep... | AST#method_declaration#Left static getCacheDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName ? : AST#type_annotation#Left AST#primary_type#Left string AST... | static getCacheDirPath(dirPath: string, fileName?: string): string {
let filePath = getContext().cacheDir;
if (!StrUtil.isEmpty(dirPath)) {
if (FileUtil.hasDirPath(dirPath)) {
filePath = dirPath;
} else {
filePath = filePath + FileUtil.separator + dirPath;
}
if (!fs.ac... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L64-L80 | 72a4b260c8bfa06fccc9177e0c79362212aa593d | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | arkts/@arkts.collections.d.ets | arkts | flipBitsByRange | Flips a range of bit values in a bit vector.(Flip 0 to 1, flip 1 to 0).
@param { number } fromIndex - The starting position of the index, containing the value at that index position.
@param { number } toIndex - The end of the index, excluding the value at that index.
@throws { BusinessError } 401 - Parameter error. Po... | flipBitsByRange(fromIndex: number, toIndex: number): void; | AST#method_declaration#Left flipBitsByRange AST#parameter_list#Left ( AST#parameter#Left fromIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | flipBitsByRange(fromIndex: number, toIndex: number): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12494-L12494 | b7860d478731c0b73abf4d7992e38978b480906f | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets | arkts | generateTransformedValuesScatter | Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the SCATTERCHART.
@param data
@return | public generateTransformedValuesScatter(
data: IScatterDataSet,
phaseX: number,
phaseY: number,
froms: number,
to: number
): number[] {
const count: number = to - froms * phaseX + 1 * 2;
if (this.valuePointsForGenerateTransformedValuesScatter.length != count) {
this.valuePointsForGe... | AST#method_declaration#Left public generateTransformedValuesScatter AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IScatterDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_t... | public generateTransformedValuesScatter(
data: IScatterDataSet,
phaseX: number,
phaseY: number,
froms: number,
to: number
): number[] {
const count: number = to - froms * phaseX + 1 * 2;
if (this.valuePointsForGenerateTransformedValuesScatter.length != count) {
this.valuePointsForGe... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L103-L132 | d5a507342840b19023744b151c1a0e3437531494 | gitee |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleD/entry/src/main/ets/component/SearchResultComponent.ets | arkts | aboutToAppear | 综合、视频等title选择索引 | aboutToAppear() {
// 默认值
if (this.inputSearch === '') {
this.inputSearch = MockInput.TEST_INPUT_CONTENT_1;
}
// 依据不同的搜索展示不同的模拟数据
Logger.info(TAG, `this.inputSearch: ${JSON.stringify(this.inputSearch)}`);
if (this.inputSearch.indexOf(MockInput.TEST_INPUT_CONTENT_1) !== -1) {
// 输入"黑夜问... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 默认值 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#express... | aboutToAppear() {
if (this.inputSearch === '') {
this.inputSearch = MockInput.TEST_INPUT_CONTENT_1;
}
Logger.info(TAG, `this.inputSearch: ${JSON.stringify(this.inputSearch)}`);
if (this.inputSearch.indexOf(MockInput.TEST_INPUT_CONTENT_1) !== -1) {
this.currSearchResult = thi... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/component/SearchResultComponent.ets#L35-L53 | c3e90236b7b0f92b8e9f3c5eb264ffad42581e02 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/TypingStart.ets | arkts | 应用约束:1. 强制使用静态类型 | constructor(
client: any,
since: Date,
lastTimestamp: Date,
_timeout: number
) {
this.client = client;
this.since = since;
this.lastTimestamp = lastTimestamp;
this._timeout = _timeout;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left since : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Rig... | constructor(
client: any,
since: Date,
lastTimestamp: Date,
_timeout: number
) {
this.client = client;
this.since = since;
this.lastTimestamp = lastTimestamp;
this._timeout = _timeout;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/TypingStart.ets#L53-L63 | 49405cf05b124fe1a21187819797a77d65c41606 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CharUtil.ets | arkts | TODO 字符工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class CharUtil {
/**
* 判断字符串char是否是数字
* @param char
* @returns
*/
static isDigit(char: string): boolean {
return i18n.Unicode.isDigit(char);
}
/**
* 判断字符串char是否是字母
* @param char
* @returns
*/
static isLetter(char: string): boolean {
return i18n.Unicode.isLetter(char);... | AST#export_declaration#Left export AST#class_declaration#Left class CharUtil AST#class_body#Left { /**
* 判断字符串char是否是数字
* @param char
* @returns
*/ AST#method_declaration#Left static isDigit AST#parameter_list#Left ( AST#parameter#Left char : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | export class CharUtil {
static isDigit(char: string): boolean {
return i18n.Unicode.isDigit(char);
}
static isLetter(char: string): boolean {
return i18n.Unicode.isLetter(char);
}
static isLowerCase(char: string): boolean {
return i18n.Unicode.isLowerCase(char);
}
static isUpp... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CharUtil.ets#L23-L125 | 27c8a8ab9279e4a579179ab839c5fb352276239b | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/Reader/MusicPlayer.ets | arkts | formatMilliseconds | private Player: media.AVPlayer = new media 格式化时间 | formatMilliseconds(milliseconds: number): string {
const totalSeconds = Math.floor(milliseconds / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
// 格式化秒数为两位数字
const formattedSeconds = seconds < 10 ? `0${seconds}` : `${seconds}`;
return `${minutes}:${fo... | AST#method_declaration#Left formatMilliseconds AST#parameter_list#Left ( AST#parameter#Left milliseconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | formatMilliseconds(milliseconds: number): string {
const totalSeconds = Math.floor(milliseconds / 1000);
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
const formattedSeconds = seconds < 10 ? `0${seconds}` : `${seconds}`;
return `${minutes}:${formattedSecond... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/Reader/MusicPlayer.ets#L25-L34 | f98edfad98afec7d40b97efcde8a86bc9746a43a | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | generateId | 生成弹框id | static generateId() {
return ActionBaseCore.getInstance().generateDialogId();
} | AST#method_declaration#Left static generateId AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#e... | static generateId() {
return ActionBaseCore.getInstance().generateDialogId();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L120-L122 | 87405a216aeeeb181a165b92563da3edc315b75c | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets | arkts | decodeECB | 解密-ECB模式
@param str 加密的字符串
@param sm4Key SM4密钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 | static decodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, keyCoding, dataCoding);
} | AST#method_declaration#Left static decodeECB 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, keyCoding, dataCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L58-L61 | ed39c8bb37ef49111a65913409f8c5d1508c402b | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets | arkts | getKeyValue | 获取 JSON key 值 | static getKeyValue( data:string, ...args) {
let jsonObject = JSON.parse(data);
let properties = jsonObject.services[0].properties;
let arr = []
for( var i = 0; i < args.length; i++) {
let key = args[i]
arr[i] = properties[key]
}
return arr;
} | AST#method_declaration#Left static getKeyValue 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 ... args AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#L... | static getKeyValue( data:string, ...args) {
let jsonObject = JSON.parse(data);
let properties = jsonObject.services[0].properties;
let arr = []
for( var i = 0; i < args.length; i++) {
let key = args[i]
arr[i] = properties[key]
}
return arr;
} | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets#L27-L36 | db0d9dc0d298642a44e2be72875361f264a1ddef | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | getDate | 获取时间(毫秒) | private getDate(): string {
let date = new Date(systemDateTime.getTime());
const formattedTime = `${date.getTime().toString()}`;
Logger.debug(this.LOG_TAG, formattedTime);
return formattedTime;
} | AST#method_declaration#Left private getDate 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#variable_declaration#Left let AST#variable_declarator#Left date = AS... | private getDate(): string {
let date = new Date(systemDateTime.getTime());
const formattedTime = `${date.getTime().toString()}`;
Logger.debug(this.LOG_TAG, formattedTime);
return formattedTime;
} | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/CommonUtils.ets#L200-L207 | 843c67352d6eee8eb92d1199ce6db6b8bb72f6a0 | github |
conrad_sheeran/TickAuth | 8ef852e12999d15cf70394cdab82d08ac5843143 | features/steam/src/main/ets/common/Constants.ets | arkts | Copyright (c) 2024 Yang He
TickAuth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be... | export class Constants {
static readonly DOMAIN: number = 0x00203;
static readonly TOTPVIEW_LIST_SIZE: string = "100%";
static readonly TOTPVIEW_LIST_SPACE: number = 12;
static readonly TOTPVIEW_LISTITEM_MAXLINE: number = 1;
static readonly TOTPVIEW_LISTITEM_TOTP_WIDTH: string = "50%";
static readonly ... | AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly DOMAIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0x00203 AST#expression#Right ; AST#prope... | export class Constants {
static readonly DOMAIN: number = 0x00203;
static readonly TOTPVIEW_LIST_SIZE: string = "100%";
static readonly TOTPVIEW_LIST_SPACE: number = 12;
static readonly TOTPVIEW_LISTITEM_MAXLINE: number = 1;
static readonly TOTPVIEW_LISTITEM_TOTP_WIDTH: string = "50%";
static readonly ... | https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/steam/src/main/ets/common/Constants.ets#L18-L38 | cd6a092c761c565132ebaede87a3cb10898386d4 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LocateUtil.ets | arkts | getPreLocationPosition | Get cache location information | public static getPreLocationPosition() {
try {
let location = geoLocationManager.getLastLocation();
LocateUtil.userLatitude = location.latitude;
LocateUtil.userLongitude = location.longitude;
Logger.debug(TAG,
`getPreLocationPosition success, latitude: ${location.latitude}, longitude... | AST#method_declaration#Left public static getPreLocationPosition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left location = AST#expre... | public static getPreLocationPosition() {
try {
let location = geoLocationManager.getLastLocation();
LocateUtil.userLatitude = location.latitude;
LocateUtil.userLongitude = location.longitude;
Logger.debug(TAG,
`getPreLocationPosition success, latitude: ${location.latitude}, longitude... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LocateUtil.ets#L25-L36 | 803465c446fda59321d26634b3f6003db0308ee4 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/select/Cascade.ets | arkts | getAreaData | 获取区县数据
@param prevCode 省code
@param cityCode 市code
@returns | private getAreaData(prevCode: string, cityCode: string): Array<City> {
return ((this.provinceList.filter((pro: City) => pro.code == prevCode)
.pop() as City).children.filter((city: City) => city.code == cityCode).pop() as City).children;
} | AST#method_declaration#Left private getAreaData AST#parameter_list#Left ( AST#parameter#Left prevCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cityCode : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | private getAreaData(prevCode: string, cityCode: string): Array<City> {
return ((this.provinceList.filter((pro: City) => pro.code == prevCode)
.pop() as City).children.filter((city: City) => city.code == cityCode).pop() as City).children;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L126-L129 | 5334f17b889d83e5675d06e3c46b9a2b6cf3c0b7 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/model/SafeAreaInsets.ets | arkts | @file 安全区内边距类型定义
@author Joker.X
安全区内边距 | export interface SafeAreaInsets {
/**
* 顶部安全区边距(vp)
*/
top: number;
/**
* 左侧安全区边距(vp)
*/
left: number;
/**
* 底部安全区边距(vp)
*/
bottom: number;
/**
* 右侧安全区边距(vp)
*/
right: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SafeAreaInsets AST#object_type#Left { /**
* 顶部安全区边距(vp)
*/ AST#type_member#Left top : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 左侧安全区边距(vp)
*... | export interface SafeAreaInsets {
top: number;
left: number;
bottom: number;
right: number;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/model/SafeAreaInsets.ets#L9-L29 | 9a18433aaaa746e7fb429e83d6b8acf31b44358c | github | |
ChangweiZhang/chardet-arkts.git | 3a214882ec6a2753c0fed84162952aa659341c19 | src/main/ets/components/utils.ets | arkts | May also check if every element is a number <= 255 but it a little bit slower | export function isByteArray(input: Uint8Array): boolean {
if (input == null || typeof input != 'object') return false;
return isFinite(input.length) && input.length >= 0;
}
; | AST#export_declaration#Left export AST#function_declaration#Left function isByteArray AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ... | export function isByteArray(input: Uint8Array): boolean {
if (input == null || typeof input != 'object') return false;
return isFinite(input.length) && input.length >= 0;
}
; | https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/utils.ets#L3-L8 | 72ff12e1abb1b49b528060e60bb274c8443d7d98 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/Index.ets | arkts | TabBuilder | 设置tabBar样式的位置、未选中图片、选中图片及文字显示的参数 | @Builder
TabBuilder(index: number, imageNormal: Resource, imageSelected: Resource, text: Resource) {
Column() {
Divider()
.vertical(false)
.strokeWidth(DIVIDER_LINE_STROKWIDTH)
.color($r('app.color.tab_bar_separator_line_color'))
.opacity(TABBAR_SEPARATE_LINE)
Image(thi... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageNormal : AST#type_annotation#L... | @Builder
TabBuilder(index: number, imageNormal: Resource, imageSelected: Resource, text: Resource) {
Column() {
Divider()
.vertical(false)
.strokeWidth(DIVIDER_LINE_STROKWIDTH)
.color($r('app.color.tab_bar_separator_line_color'))
.opacity(TABBAR_SEPARATE_LINE)
Image(thi... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/Index.ets#L39-L115 | 13e206455778a32f9fbccd8c5afde7ee7ffdb602 | gitee |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/utils/StorageUtils.ets | arkts | getPreferences | 获取Prefer实例
@param preferenceName
@returns | static async getPreferences(preferenceName: string = defaultPreferenceName) {
return await dataPreferences.getPreferences(this.context, preferenceName)
} | AST#method_declaration#Left static async getPreferences AST#parameter_list#Left ( AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left defaultPreferenceName AST#expression#Right AST#parameter#Right ) AST#paramete... | static async getPreferences(preferenceName: string = defaultPreferenceName) {
return await dataPreferences.getPreferences(this.context, preferenceName)
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/utils/StorageUtils.ets#L21-L23 | 2b6a688e0a20ba20cf41519a7381e758f3a36522 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | @file Toast 工具类,封装 IBestToast 常用能力
@author Joker.X | export class ToastUtils {
/**
* 显示普通 Toast
* @param {string | ResourceStr} message - 提示内容
* @returns {void} 无返回值
*/
static show(message: string | ResourceStr): void {
IBestToast.show(message);
}
/**
* 显示成功提示
* @param {string | ResourceStr} message - 提示内容
* @returns {void} 无返回值
*/
... | AST#export_declaration#Left export AST#class_declaration#Left class ToastUtils AST#class_body#Left { /**
* 显示普通 Toast
* @param {string | ResourceStr} message - 提示内容
* @returns {void} 无返回值
*/ AST#method_declaration#Left static show AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Le... | export class ToastUtils {
static show(message: string | ResourceStr): void {
IBestToast.show(message);
}
static showSuccess(message: string | ResourceStr): void {
IBestToast.show({
type: "success",
message: message
});
}
static showError(message: string | ResourceStr): void ... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L7-L145 | e8dea7167d4519bc54ded728793205a8257d4fa6 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/ButtonUtil.ets | arkts | ButtonUtil | @Author csx
@DateTime 2024/7/2 16:24:07
@TODO ButtonUtil 场景化按钮工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | @Component
export struct ButtonUtil {
/**
* 场景按钮入参实体
*/
@Prop btnOptions: BtnOptions = new BtnOptions();
build() {
FunctionalButtonBuilder.builder({
openType: this.btnOptions.type,
label: this.btnOptions.label,
styleOption: {
//按钮镂空
plain: true
},
appParam:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ButtonUtil AST#component_body#Left { /**
* 场景按钮入参实体
*/ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right btnOptions : AST#type_annotation#Left AST#primary_type#Left BtnOptions AST#prima... | @Component
export struct ButtonUtil {
@Prop btnOptions: BtnOptions = new BtnOptions();
build() {
FunctionalButtonBuilder.builder({
openType: this.btnOptions.type,
label: this.btnOptions.label,
styleOption: {
plain: true
},
appParam: this.btnOptions.appParams
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/ButtonUtil.ets#L204-L224 | e00217f09eb434579b60db1b82c884e26d18181e | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/ImmersionUtil.ets | arkts | getBoundingRectPosition | TODO 知识点:通过获取到的屏幕属性和屏幕不可用区域来判断不可用区域位置
1.getCutoutInfo接口获取到不可用区域的左边界、上边界、宽度、高度。
2.不可用区域左边宽度即为左边界的值。
3.不可用区域右边界宽度等于屏幕宽度减去不可用区域宽度和左边界。
4.获取到不可用区域到左右屏幕边缘的宽度进行对比判断出不可用区域位置。
5.不可用区域位于中间时,不同设备左右距离可能存在小于10的差值,判断是否在中间取去左右距离差值的绝对值进行判断。
@returns left:左偏移量 right:右偏移量 | getBoundingRectPosition(): TextMargin {
if (this.boundingRect !== null && this.displayClass !== null && this.boundingRect[0] !== undefined) {
// 不可用区域右侧到屏幕右边界的距离:屏幕宽度减去左侧宽度和不可用区域宽度
const boundingRectRight: number =
this.displayClass.width - (this.boundingRect[0].left + this.boundingRect[0].width... | AST#method_declaration#Left getBoundingRectPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TextMargin 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_ex... | getBoundingRectPosition(): TextMargin {
if (this.boundingRect !== null && this.displayClass !== null && this.boundingRect[0] !== undefined) {
const boundingRectRight: number =
this.displayClass.width - (this.boundingRect[0].left + this.boundingRect[0].width);
const boundingRectLeft... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/ImmersionUtil.ets#L108-L128 | 06ba20ac7d1f744b715d67e6d6c3bee2777eac98 | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 取消收藏列表文章
@param date
@returns | export function unCollectListArticle(id: number,originId:number) {
return axiosClient.post<any>({
url: `lg/uncollect/${id}/json`,
params: {
originId:originId || -1
},
checkResultCode: true,
checkLoginState: true,
needJumpToLogin: true
})
} | AST#export_declaration#Left export AST#function_declaration#Left function unCollectListArticle AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left originId : AST#type_annotation#... | export function unCollectListArticle(id: number,originId:number) {
return axiosClient.post<any>({
url: `lg/uncollect/${id}/json`,
params: {
originId:originId || -1
},
checkResultCode: true,
checkLoginState: true,
needJumpToLogin: true
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L93-L103 | 1afb73bbfda06b1e1b0a250b75db791687e81291 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets | arkts | getFileIdFromUri | 从URI中获取文件ID - 修正正则表达式以正确提取ID | private getFileIdFromUri(uri: string): string | null {
try {
// 匹配形如 file://media/Photo/1/IMG_1747504493_000/xxx.png 的URI
const regex = /file:\/\/media\/Photo\/(\d+)\/([^\/]+)/;
const match = uri.match(regex);
if (match && match.length >= 2) {
return match[1]; // 返回ID部分 (1)
}
... | AST#method_declaration#Left private getFileIdFromUri AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Le... | private getFileIdFromUri(uri: string): string | null {
try {
const regex = /file:\/\/media\/Photo\/(\d+)\/([^\/]+)/;
const match = uri.match(regex);
if (match && match.length >= 2) {
return match[1];
}
return null;
} catch (error) {
const errorMsg: string = er... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L848-L862 | f08b114b3c244ad16bd6510affb42225099d47e3 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/view/WebPage.ets | arkts | WebPage | @file 网页页面视图
@author Joker.X | @ComponentV2
export struct WebPage {
/**
* 网页页面 ViewModel
*/
@Local
private vm: WebViewModel = new WebViewModel();
/**
* 构建网页页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: "网页",
viewModel: this.vm
}) {
this.WebContent();
}
}
/**
* 网页页面内容... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct WebPage AST#component_body#Left { /**
* 网页页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left WebViewModel A... | @ComponentV2
export struct WebPage {
@Local
private vm: WebViewModel = new WebViewModel();
build() {
AppNavDestination({
title: "网页",
viewModel: this.vm
}) {
this.WebContent();
}
}
@Builder
private WebContent() {
Text("网页页面内容视图")
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/WebPage.ets#L8-L37 | 44431be8660a45a7a043d6fe12c56019d2f177c4 | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/DimensionUtils.ets | arkts | getVp | 获取屏幕水平适配 vp 值。
@param value 资源值
@return 适配后的 vp 值 | static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
} | AST#method_declaration#Left static getVp AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/DimensionUtils.ets#L52-L55 | b43479a5bd17023bb40fdb4a8f5aecf99389205c | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/PlayerSettingBuilder.ets | arkts | createDivider | 创建特定样式的分隔线 | @Builder
createDivider() {
Divider()
.vertical(false)
.strokeWidth(0.5)
.color(0xE0E0E0)
.width('80%')
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createDivider 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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expres... | @Builder
createDivider() {
Divider()
.vertical(false)
.strokeWidth(0.5)
.color(0xE0E0E0)
.width('80%')
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/PlayerSettingBuilder.ets#L109-L116 | f66db7b815e65aa624ef16f14e65455bcb648ed1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/advertisingpage/src/main/ets/components/AdvertisingPage.ets | arkts | AdvertisingPageComponent | 按键靠近右侧屏幕距离
功能描述:本示例介绍了如何实现全屏启动页
推荐场景:应用冷启动广告页
核心组件:
1.changeFullScreen
2.timerInterval
实现步骤:
1.通过window.getLastWindow在页面启动时实现沉浸式布局。
2.通过定时器设置自动进入页面时长,也可手动跳过进入页面。 | @Component
export struct AdvertisingPageComponent {
@State pageCountDown: number = 6; // 进场动画总用时6s
@StorageProp('windowSize') windowSize: window.Size = {
width: display.getDefaultDisplaySync().width,
height: display.getDefaultDisplaySync().height
};
@Link isShow: boolean;
private timer: number = 0;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AdvertisingPageComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right pageCountDown : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri... | @Component
export struct AdvertisingPageComponent {
@State pageCountDown: number = 6;
@StorageProp('windowSize') windowSize: window.Size = {
width: display.getDefaultDisplaySync().width,
height: display.getDefaultDisplaySync().height
};
@Link isShow: boolean;
private timer: number = 0;
changeFu... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/advertisingpage/src/main/ets/components/AdvertisingPage.ets#L35-L129 | 3bf36e44baa8a1bf038db4858586964e9dbcdfe6 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/onlinesearch/OnlineWordManager.ets | arkts | loadWord | / 查询单词详情 | loadWord(titleEn: string, completion: (success: boolean, msg: string | null, word: OnlineWord | null) => void): void {
const params: HttpUtils.HttpParams = {}
params[CodingKeys.TitleEn] = titleEn
const isCurCnt = LanguageManager.isTraditionalChinese()
const subRoute = isCurCnt ? "word_cnt" : "word_cns"... | AST#method_declaration#Left loadWord AST#parameter_list#Left ( AST#parameter#Left titleEn : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left completion : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left... | loadWord(titleEn: string, completion: (success: boolean, msg: string | null, word: OnlineWord | null) => void): void {
const params: HttpUtils.HttpParams = {}
params[CodingKeys.TitleEn] = titleEn
const isCurCnt = LanguageManager.isTraditionalChinese()
const subRoute = isCurCnt ? "word_cnt" : "word_cns"... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/onlinesearch/OnlineWordManager.ets#L24-L47 | b9a43f238000cd60a74ca77c0018e01a313b7e29 | github |
fengcreate/harmony-document | 798534b0f76399dc84e7940f5b14b3ae4e53c6a9 | BackupRestore/entry/src/main/ets/restore/fileMigrate/FileTransferManager.ets | arkts | File migration and conversion management. | export default class FileTransferManager {
/**
* Move HarmonyOS 4.0 files to the designated location of HarmonyOS NEXT.
*
* @param context context.
*/
transfer(context: common.Context): void {
if (this.moveFiles(context)) {
hilog.info(0x0000, 'BackupRestore FileTransferManager', 'transfer succ... | AST#export_declaration#Left export default AST#class_declaration#Left class FileTransferManager AST#class_body#Left { /**
* Move HarmonyOS 4.0 files to the designated location of HarmonyOS NEXT.
*
* @param context context.
*/ AST#method_declaration#Left transfer AST#parameter_list#Left ( AST#parameter#Left ... | export default class FileTransferManager {
transfer(context: common.Context): void {
if (this.moveFiles(context)) {
hilog.info(0x0000, 'BackupRestore FileTransferManager', 'transfer success');
return;
}
hilog.error(0x0000, 'BackupRestore FileTransferManager', 'transfer fail');
}
pri... | https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/fileMigrate/FileTransferManager.ets#L23-L77 | fb9e993c7005a9ed08d42068073e24c9d8294f28 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/I18nManager.ets | arkts | getCurrentLanguage | 获取当前语言 | getCurrentLanguage(): SupportedLanguage {
return this.currentLanguage;
} | AST#method_declaration#Left getCurrentLanguage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#m... | getCurrentLanguage(): SupportedLanguage {
return this.currentLanguage;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L359-L361 | 8b9770d2082b37334fa8150b333a723e8a3c9fec | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets | arkts | 构建对话框的内容 | build() {
// 使用Flex布局
Flex() {
// 如果间隔时间或间隔次数大于0
if ((this.intervalTimesSelect | this.intervalMinuteSelect) > 0) {
// 创建一个通用对话框
CommonDialog({
title: $r('app.string.ring_interval'), // 设置标题
controller: this.controller, // 设置控制器
// 确认按钮的回调函数
onC... | AST#build_method#Left build ( ) AST#build_body#Left { // 使用Flex布局 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( ) AST#container_content_body#Left { // 如果间隔时间或间隔次数大于0 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expr... | build() {
Flex() {
if ((this.intervalTimesSelect | this.intervalMinuteSelect) > 0) {
CommonDialog({
title: $r('app.string.ring_interval'),
controller: this.controller,
onConfirm: () => {
this.alarmItem.intervalMin... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/IntervalDialog.ets#L29-L57 | a271c43e9c03752b7a1638b14a82b98247861dcd | github | |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets | arkts | 视频展示图片的文件名称 | constructor(videoAuthorName: string, videoAuthorIcon: Resource, videoLikeNum: string, videoTitle: string, video: Resource) {
this.videoAuthorName = videoAuthorName;
this.videoAuthorIcon = videoAuthorIcon;
this.videoLikeNum = videoLikeNum;
this.videoTitle = videoTitle;
this.video = video;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left videoAuthorName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left videoAuthorIcon : AST#type_annotation#Left AST#primary_type#Left Res... | constructor(videoAuthorName: string, videoAuthorIcon: Resource, videoLikeNum: string, videoTitle: string, video: Resource) {
this.videoAuthorName = videoAuthorName;
this.videoAuthorIcon = videoAuthorIcon;
this.videoLikeNum = videoLikeNum;
this.videoTitle = videoTitle;
this.video = video;
} | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets#L90-L96 | 0959b4a4f72d611525d3cfa0fbdb16bc408fe80a | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/theme/ThemeManager.ets | arkts | getCurrentTheme | 获取当前主题 | getCurrentTheme(): ThemeMode {
return this.currentTheme;
} | AST#method_declaration#Left getCurrentTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ThemeMode 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_expre... | getCurrentTheme(): ThemeMode {
return this.currentTheme;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/theme/ThemeManager.ets#L96-L98 | 5f4686c53c2f9edc243da53e14499e0f94c7ab89 | github |
CongDuang/PlayHarmony.git | 674a0459e1b20db9de8c837dff6a8d1f06330e79 | entry/src/main/ets/pages/main/view/HomeView.ets | arkts | getHomeListData | 获取首页列表数据
@param page 页码
@returns | async getHomeListData(page: number): Promise<boolean> {
let topArticleList: ArticleModel[] = [];
if (page === 0) {
const topArticleResp = await HttpUtil.getInstance().get<ArticleModel[], undefined>('/article/top/json')
if (topArticleResp.errorCode === ErroCode.OK && topArticleResp.data) {
to... | AST#method_declaration#Left async getHomeListData AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | async getHomeListData(page: number): Promise<boolean> {
let topArticleList: ArticleModel[] = [];
if (page === 0) {
const topArticleResp = await HttpUtil.getInstance().get<ArticleModel[], undefined>('/article/top/json')
if (topArticleResp.errorCode === ErroCode.OK && topArticleResp.data) {
to... | https://github.com/CongDuang/PlayHarmony.git/blob/674a0459e1b20db9de8c837dff6a8d1f06330e79/entry/src/main/ets/pages/main/view/HomeView.ets#L41-L69 | 916d759c56d4b24fc3732f60e9e2ca9dd158a50d | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isArrayBuffer | 检查是否为ArrayBuffer类型。
@param value
@returns | static isArrayBuffer(value: Object): boolean {
return new util.types().isArrayBuffer(value);
} | AST#method_declaration#Left static isArrayBuffer AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | static isArrayBuffer(value: Object): boolean {
return new util.types().isArrayBuffer(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L145-L147 | e280d8722f80ec93ad3c80b45811d57d042640b4 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets | arkts | Constructor initialization to generate a key. | constructor() {
let symAlgName = CommonConstants.ENCRYPTION_MODE;
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(symAlgName);
// Randomly generate a 256-bit symmetric key by using a key generator.
let keyMaterialBlob = this.genKeyMaterialBlob(CommonConstants.KEY_DATA);
symKeyGenerator.c... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symAlgName = AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Ri... | constructor() {
let symAlgName = CommonConstants.ENCRYPTION_MODE;
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(symAlgName);
let keyMaterialBlob = this.genKeyMaterialBlob(CommonConstants.KEY_DATA);
symKeyGenerator.convertKey(keyMaterialBlob, (err, symKey) => {
if (err) {
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets#L29-L48 | 2c27c62a23dc447b45a1d4ae8fbb1decbfeb8daf | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildCalendarContent | 构建日历页面内容 | @Builder
buildCalendarContent() {
Stack() {
Column({ space: 16 }) {
// 日历头部 - 月份导航
this.buildCalendarHeader()
// 日历网格
this.buildCalendarGrid()
// 日期操作面板显示区域
if (this.showDateActionPanel) {
// 日期详情面板
Column({ space: 16 }) {
// ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCalendarContent 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 Stack ( ) AST#container_content_body#Left { AST#arkts... | @Builder
buildCalendarContent() {
Stack() {
Column({ space: 16 }) {
this.buildCalendarHeader()
this.buildCalendarGrid()
if (this.showDateActionPanel) {
Column({ space: 16 }) {
Row() {
Column({ sp... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L2164-L2276 | 9c322a4ec4f2f469cac918c91ce95c9ae2931ca4 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/pages/Index.ets | arkts | copyingFileByUriExample | [Start function_example] [Start copy_file_uri_example ] | async copyingFileByUriExample() {
let fileAccessHelper: fileAccess.FileAccessHelper;
// wantInfos 从getFileAccessAbilityInfo()获取
let wantInfos: Want[] = [
{
bundleName: 'com.ohos.UserFile.ExternalFileManager',
abilityName: 'FileExtensionAbility',
},
];
try {
fileAcce... | AST#method_declaration#Left async copyingFileByUriExample AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fileAccessHelper : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fileAccess... | async copyingFileByUriExample() {
let fileAccessHelper: fileAccess.FileAccessHelper;
let wantInfos: Want[] = [
{
bundleName: 'com.ohos.UserFile.ExternalFileManager',
abilityName: 'FileExtensionAbility',
},
];
try {
fileAccessHelper = fileAccess.createFileAccessHelp... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/UserFileURI/entry/src/main/ets/pages/Index.ets#L261-L301 | 96630a22f4c8e014d15c66be341878527dd0fc91 | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/BubbleSort.ets | arkts | sort | 冒泡排序算法
@param arr 需要排序的数组
@returns 排序后的数组 | public static sort(arr: number[]): number[] {
const n = arr.length;
// 创建数组副本以避免修改原数组
const result = [...arr];
for (let i = 0; i < n - 1; i++) {
for (let j = 0; j < n - i - 1; j++) {
// 如果当前元素大于下一个元素,则交换它们
if (result[j] > result[j + 1]) {
// 使用临时变量进行交换
cons... | 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 n = arr.length;
const result = [...arr];
for (let i = 0; i < n - 1; i++) {
for (let j = 0; j < n - i - 1; j++) {
if (result[j] > result[j + 1]) {
const temp = result[j];
result[j] = result[j +... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/BubbleSort.ets#L10-L28 | 79b8dd55902bf865ca0661cf04cfa4c689aec7b1 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/ChatTools.ets | arkts | getLocalUserUid | 返回本地用户UID.
@returns local uid | static getLocalUserUid(): string | undefined {
// return ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId
return "";
} | AST#method_declaration#Left static getLocalUserUid AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_sta... | static getLocalUserUid(): string | undefined {
return "";
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L86-L89 | b0bd4756c17f2f62400f12d9cb94d9ce03b7c77e | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/view/Side.ets | arkts | changeLikeCount | The callback function for the click event of the like button.
@param isAdd | private changeLikeCount(isAdd: boolean) {
let likeCountNum = Number(this.likeCount);
if(isAdd) {
likeCountNum++;
} else {
likeCountNum--;
}
this.likeCount = '' + likeCountNum;
animateTo({ duration: Const.DURATION, curve: Curve.EaseInOut }, () => {
this.isLike = !this.isLike;
... | AST#method_declaration#Left private changeLikeCount AST#parameter_list#Left ( AST#parameter#Left isAdd : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_decla... | private changeLikeCount(isAdd: boolean) {
let likeCountNum = Number(this.likeCount);
if(isAdd) {
likeCountNum++;
} else {
likeCountNum--;
}
this.likeCount = '' + likeCountNum;
animateTo({ duration: Const.DURATION, curve: Curve.EaseInOut }, () => {
this.isLike = !this.isLike;
... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/Side.ets#L21-L32 | 6cc40172892184308fb136de66dd012736d5b665 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/constants/ListConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class ListConstants {
// 自动分配剩余空间
static readonly LAYOUT_WEIGHT: number = 1;
// 列表默认间隔
static readonly LIST_SPACE: number = 10;
} | AST#export_declaration#Left export AST#class_declaration#Left class ListConstants AST#class_body#Left { // 自动分配剩余空间 AST#property_declaration#Left static readonly LAYOUT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#... | export class ListConstants {
static readonly LAYOUT_WEIGHT: number = 1;
static readonly LIST_SPACE: number = 10;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/constants/ListConstants.ets#L16-L21 | 4ccdf1e501e27300c4ccf08154881a470a699632 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/entryability/EntryAbility.ets | arkts | immersionFuc | Page immersion. | immersionFuc(windowStage: window.WindowStage): void {
try {
let windowClass: window.Window = windowStage.getMainWindowSync();
windowClass.setWindowLayoutFullScreen(true);
let navigationBarArea: window.AvoidArea =
windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR... | AST#method_declaration#Left immersionFuc AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#t... | immersionFuc(windowStage: window.WindowStage): void {
try {
let windowClass: window.Window = windowStage.getMainWindowSync();
windowClass.setWindowLayoutFullScreen(true);
let navigationBarArea: window.AvoidArea =
windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/entryability/EntryAbility.ets#L66-L80 | 1155e2c483fff8dc3eb6401a72102b8d06c1ccd6 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/GreetingsPage.ets | arkts | buildFilterChip | 构建筛选标签 | @Builder
buildFilterChip(label: string, value: string, count: number) {
Button(`${label}(${count})`)
.type(ButtonType.Capsule)
.fontSize(14)
.fontColor(this.selectedOccasion === value || (value === 'all' && this.selectedOccasion === 'all') ? '#ffffff' : '#666666')
.backgroundColor(this.sel... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFilterChip AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Le... | @Builder
buildFilterChip(label: string, value: string, count: number) {
Button(`${label}(${count})`)
.type(ButtonType.Capsule)
.fontSize(14)
.fontColor(this.selectedOccasion === value || (value === 'all' && this.selectedOccasion === 'all') ? '#ffffff' : '#666666')
.backgroundColor(this.sel... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L269-L282 | fe30ba8be6e21482c9631c594970e5b60aaffdd0 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.multimedia.avInputCastPicker.d.ets | arkts | AVInputCastPicker | A picker view to show availale input device list.
@struct { AVInputCastPicker }
@syscap SystemCapability.Multimedia.AVSession.AVInputCast
@atomicservice
@since 20 | @Component
export declare struct AVInputCastPicker {
/**
* Set the custom builder for the picker appearance.
* If not set, system will show the default appearance for different device type.
* @type { ? CustomBuilder }
* @syscap SystemCapability.Multimedia.AVSession.AVInputCast
* @atomicservice
* @s... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AVInputCastPicker AST#component_body#Left { /**
* Set the custom builder for the picker appearance.
* If not set, system will show the default appearance for different devi... | @Component
export declare struct AVInputCastPicker {
@Prop
customPicker?: CustomBuilder;
onStateChange?: OnPickerStateCallback;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.multimedia.avInputCastPicker.d.ets#L30-L52 | e52eddc83a7cf38494152413d109762afec598bf | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@system.app.d.ets | arkts | Defines the option of RequestFullWindow interface.
@interface RequestFullWindowOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 3
Defines the option of RequestFullWindow interface.
@interface RequestFullWindowOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export interface RequestFullWindowOptions {
/**
* Defines the number of animation options.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 3
*/
/**
* Defines the number of animation options.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
*... | AST#export_declaration#Left export AST#interface_declaration#Left interface RequestFullWindowOptions AST#object_type#Left { /**
* Defines the number of animation options.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 3
*/ /**
* Defines the number of animation options.
... | export interface RequestFullWindowOptions {
duration: number;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.app.d.ets#L206-L223 | 879167fbfb4250072ed6a39254a27e95fb2e2925 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/BgCardShape.ets | arkts | @Local settings: UserSettings = PersistenceV2.connect(UserSettings, GlobalKey.kUserSettings)! | build() {
// if (this.settings.isListOneCircle) {
// // 圆形卡片
// Circle()
// .width('100%')
// .height('100%')
// .fill(Color.White)
// .borderRadius('100%')
// .shadow({
// radius: 10,
// color: Color.Gray,
// offsetX: 10,
// ... | AST#build_method#Left build ( ) AST#build_body#Left { // if (this.settings.isListOneCircle) { // // 圆形卡片 // Circle() // .width('100%') // .height('100%') // .fill(Color.White) // .borderRadius('100%') // .shadow({ // radius: 10, // color: Color.Gray, // offsetX: 10, // of... | build() {
Stack(){
Rect()
.width('100%')
.height('100%')
.fill(Color.White)
.borderRadius(16)
.radius(16)
.shadow({
radius: 10,
color: Color.Gray,
offset... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/BgCardShape.ets#L10-L53 | 3dd1d341c18568a886290b6dc4199d6798747c0c | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets | arkts | UserItemView | 列表组件 | @Component
export struct UserItemView {
// 列表项
@ObjectLink text: ListConstruction;
build() {
Row() {
Text(this.text.title)
.fontSize($r('app.integer.pinyin_list_title_size'))
.fontColor($r('app.color.pinyin_list_title_color'))
.width($r('app.integer.pinyin_setting_title_width'))... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct UserItemView AST#component_body#Left { // 列表项 AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right text : AST#type_annotation#Left AST#primary_type#Left ListConstruction AST#primary_type#R... | @Component
export struct UserItemView {
@ObjectLink text: ListConstruction;
build() {
Row() {
Text(this.text.title)
.fontSize($r('app.integer.pinyin_list_title_size'))
.fontColor($r('app.color.pinyin_list_title_color'))
.width($r('app.integer.pinyin_setting_title_width'))
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets#L185-L218 | 2978d9e6b5d1a644f36d973dc1212d129d09d5c9 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/view/GoodsCategoryPage.ets | arkts | 构建商品分类页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "商品分类",
viewModel: this.vm
}) {
this.GoodsCategoryContent();
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "商品分类" AST#expression#Right AST#component_parameter#Right , AST#component_... | build() {
AppNavDestination({
title: "商品分类",
viewModel: this.vm
}) {
this.GoodsCategoryContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsCategoryPage.ets#L20-L27 | e2f4a582b51c6f350b66c21001fd0ddd56788d23 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets | arkts | bitmapOperationAll | 位图操作所有像素 | private async bitmapOperationAll() {
if (this.pixelMap != undefined) {
// [Start pixelmap_get_pixelmap_info]
// 获取图像像素的总字节数
let pixelBytesNumber: number = this.pixelMap.getPixelBytesNumber();
Logger.info('pixelBytesNumber:', pixelBytesNumber.toString());
// 获取图像像素每行字节数
let rowCou... | AST#method_declaration#Left private async bitmapOperationAll 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 this AST#expression... | private async bitmapOperationAll() {
if (this.pixelMap != undefined) {
let pixelBytesNumber: number = this.pixelMap.getPixelBytesNumber();
Logger.info('pixelBytesNumber:', pixelBytesNumber.toString());
let rowCount: number = this.pixelMap.getBytesNumberPerRow();
Logger.i... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L322-L373 | 3927c6469bbb97faa81ae2a4649590ab86e4a681 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets | arkts | Get Module List Data in Column | export function getColumnModuleList(): Array<ContainerModuleItem> {
let columnModuleArray: Array<ContainerModuleItem> = []
COLUMN_MODULE.forEach((item: ContainerModuleItem) => {
columnModuleArray.push(item);
})
return columnModuleArray;
} | AST#export_declaration#Left export AST#function_declaration#Left function getColumnModuleList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ContainerModuleItem AST... | export function getColumnModuleList(): Array<ContainerModuleItem> {
let columnModuleArray: Array<ContainerModuleItem> = []
COLUMN_MODULE.forEach((item: ContainerModuleItem) => {
columnModuleArray.push(item);
})
return columnModuleArray;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets#L33-L39 | bc2a99922f618881030954acdb5d8704aa06f80e | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/OpusScriptEngine.ets | arkts | encode | 应用约束10:添加buffer类型和返回类型 | encode(buffer: Uint8Array): Uint8Array {
super.encode(buffer);
return this.encoder.encode(buffer, 960);
} | AST#method_declaration#Left encode AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#... | encode(buffer: Uint8Array): Uint8Array {
super.encode(buffer);
return this.encoder.encode(buffer, 960);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/opus/OpusScriptEngine.ets#L40-L43 | cacb9b5fd9483be0b20c8fede5222f56d1017474 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets | arkts | terminateSecondAbilityForResult | Stop SecondAbility itself and return the result.
@param context Context of SecondAbility. | terminateSecondAbilityForResult(context: common.UIAbilityContext) {
let abilityResult: common.AbilityResult = {
resultCode: CommonConstants.RESULT_CODE,
want: {
'deviceId': '',
'bundleName': CommonConstants.BUNDLE_NAME,
'abilityName': CommonConstants.SECOND_ABILITY_NAME,
... | AST#method_declaration#Left terminateSecondAbilityForResult AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramete... | terminateSecondAbilityForResult(context: common.UIAbilityContext) {
let abilityResult: common.AbilityResult = {
resultCode: CommonConstants.RESULT_CODE,
want: {
'deviceId': '',
'bundleName': CommonConstants.BUNDLE_NAME,
'abilityName': CommonConstants.SECOND_ABILITY_NAME,
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets#L119-L140 | dd1f1ea8f2a457f4021774bc2bfc253acb1ca66e | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | decodeECB | 解密-ECB模式
@param str 加密的字符串
@param key 给定秘钥规格密钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@param keyName 密钥长度
@param keyCoding 密钥编码方式(utf8/hex/base64)
@param dataCoding 入参字符串编码方式(hex/base64) | static decodeECB(str: string, sm4Key: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding): string {
//转换密钥
let symKey = CryptoSyncUtil.convertKeyFromStr(sm4Key, symAlgName, keyName, keyCoding);
// 初始化加解密操作环境:开始解密
l... | AST#method_declaration#Left static decodeECB 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeECB(str: string, sm4Key: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding): string {
let symKey = CryptoSyncUtil.convertKeyFromStr(sm4Key, symAlgName, keyName, keyCoding);
let mode = crypto.CryptoM... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L241-L254 | 459502327a1df41b9186e32f1dc49fe2a24da670 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | format | 设置输出格式 | public format(fmt: string): FFmpegCommandBuilder {
this.formatValue = fmt;
return this;
} | AST#method_declaration#Left public format AST#parameter_list#Left ( AST#parameter#Left fmt : 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 FFmpegCommandBuilder AST#pri... | public format(fmt: string): FFmpegCommandBuilder {
this.formatValue = fmt;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L117-L120 | f6f18651b1c550baaf61a5b1e3ca26463a3cad05 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/crash/CrashReporter.ets | arkts | init | 初始化崩溃收集 | private init(): void {
// 加载本地缓存的崩溃日志
this.loadCachedCrashes();
} | AST#method_declaration#Left private init AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 加载本地缓存的崩溃日志 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left ... | private init(): void {
this.loadCachedCrashes();
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/crash/CrashReporter.ets#L43-L46 | 804e1fecdbc2aa42a82fe5df8b81a4d44d9575e4 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 同步配置接口 | export interface SyncConfig {
enabled: boolean;
provider: SyncProvider;
lastSyncTime?: string;
autoSync: boolean;
syncInterval: number; // 小时
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SyncConfig 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 provider : AST#type_annotation... | export interface SyncConfig {
enabled: boolean;
provider: SyncProvider;
lastSyncTime?: string;
autoSync: boolean;
syncInterval: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L106-L112 | 54282ac2513cd8a2784b26776afda4c892fa1273 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets | arkts | getData | 获取索引对应的数据
@param index 数组索引 | public getData(index: number): CustomMessage {
return this.messageList[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CustomMessage AST#primary... | public getData(index: number): CustomMessage {
return this.messageList[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets#L33-L35 | 2430771d0066d617c6147c7403338712cf4d69ed | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ModelConfigService.ets | arkts | getDefaultEndpoint | 获取默认API端点 | public getDefaultEndpoint(provider: ModelProvider): string {
return this.defaultEndpoints[provider];
} | AST#method_declaration#Left public getDefaultEndpoint AST#parameter_list#Left ( AST#parameter#Left provider : AST#type_annotation#Left AST#primary_type#Left ModelProvider AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left stri... | public getDefaultEndpoint(provider: ModelProvider): string {
return this.defaultEndpoints[provider];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ModelConfigService.ets#L377-L379 | 4619211462ef39dda5bf3b696e0e2a2b06c15028 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/DetailsPage.ets | arkts | playComponent | 顶部状态栏高度 自定义播放组件。仅用于UX展示 | @Builder
playComponent() {
Column() {
Row() {
Text($r('app.string.mini_player_animation_playback_duration'))
.fontSize($r('app.float.mini_player_animation_font_size'))
.opacity($r('app.float.mini_player_animation_time_opacity'))
.fontColor(Color.White)
Slider({
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right playComponent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_el... | @Builder
playComponent() {
Column() {
Row() {
Text($r('app.string.mini_player_animation_playback_duration'))
.fontSize($r('app.float.mini_player_animation_font_size'))
.opacity($r('app.float.mini_player_animation_time_opacity'))
.fontColor(Color.White)
Slider({
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/DetailsPage.ets#L39-L116 | ef2da58e8b91451a78d0e12f85a284f904a2a238 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets | arkts | generateTransformedValuesLine | Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the LINECHART.
@param data
@return | public generateTransformedValuesLine(
data: ILineDataSet,
phaseX: number,
phaseY: number,
min: number,
max: number
): number[] {
const count: number = ((max - min) * phaseX + 1) * 2;
if (this.valuePointsForGenerateTransformedValuesLine.length != count) {
this.valuePointsForGenerateT... | AST#method_declaration#Left public generateTransformedValuesLine AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ILineDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_type#Le... | public generateTransformedValuesLine(
data: ILineDataSet,
phaseX: number,
phaseY: number,
min: number,
max: number
): number[] {
const count: number = ((max - min) * phaseX + 1) * 2;
if (this.valuePointsForGenerateTransformedValuesLine.length != count) {
this.valuePointsForGenerateT... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L177-L206 | d714d3976240a6fcc6ddd92da100d5b61e48d84b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets | arkts | animateToThrottle | 节流器:如果短时间内多次触发了同一事件,那么在函数执行一次后,在一个限期内不再执行
@param {Callback<void>} fn: 动画函数
@param {number} delay: 同一事件触发间隔
@returns | animateToThrottle(fn: Callback<void>, delay: number): void {
if (this.throttleStatus) {
// TODO: 性能知识点:播放动画时,系统需要在一个刷新周期内完成动画变化曲线的计算,完成组件布局绘制等操作。建议使用系统提供的动画接口,
// 只需设置曲线类型、终点位置、时长等信息,就能够满足常用的动画功能,减少UI主线程的负载。参考资料:
// https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-attribute-anim... | AST#method_declaration#Left animateToThrottle AST#parameter_list#Left ( AST#parameter#Left fn : 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 void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | animateToThrottle(fn: Callback<void>, delay: number): void {
if (this.throttleStatus) {
animateTo({
duration: this.animationDuration, curve: Curve.FastOutLinearIn
}, fn)
this.throttleStatus = false;
setTimeout(() => {
this.throttleStatus = true;
}, ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets#L237-L249 | cf7c9e0d491579b81c4492b7f842dc44daac530e | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/InterThreadCommunication3.ets | arkts | initSingleton | [EndExclude taskpool] | @Concurrent
function initSingleton(): void {
let demo = Demo.getInstance();
demo.init();
hilog.info(0x0000, 'InterThreadCommunication3', '%{public}s', `initSingleton success`);
// Notify the main thread that initialization is complete
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function initSingleton 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... | @Concurrent
function initSingleton(): void {
let demo = Demo.getInstance();
demo.init();
hilog.info(0x0000, 'InterThreadCommunication3', '%{public}s', `initSingleton success`);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/InterThreadCommunication3.ets#L29-L35 | f2ea858e16c42e6341974782526c9575a22df53d | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.