nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getKindOfString | / clip cn string to get kind | static getKindOfString(srcText: string): string {
const str: string | null = AppUtility.getKindFrom(srcText);
return AppUtility.getTextOfKindString(str || "");
} | AST#method_declaration#Left static getKindOfString AST#parameter_list#Left ( AST#parameter#Left srcText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | static getKindOfString(srcText: string): string {
const str: string | null = AppUtility.getKindFrom(srcText);
return AppUtility.getTextOfKindString(str || "");
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L292-L295 | 9a160bdf96549812e326a05329d54dbb7d889c96 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | getValueLineColor | When valuePosition is OutsideSlice, indicates line color
@Override | public getValueLineColor(): number {
return this.mValueLineColor;
} | AST#method_declaration#Left public getValueLineColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member... | public getValueLineColor(): number {
return this.mValueLineColor;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L184-L186 | e2b27e454dc37149395c1d7c875f34a7d657779d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/SimpleAIService.ets | arkts | generateGreeting | 生成祝福语(真实API调用) | async generateGreeting(
params: GenerationParams,
streamMode: StreamMode = StreamMode.NONE,
onStreamUpdate?: (state: StreamState) => void
): Promise<string> {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[GREETING_DEBUG] Starting generation - isConfigured: ${this.isConfigured}`);
if... | AST#method_declaration#Left async generateGreeting AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GenerationParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left streamMode : AST#type_annotation#Left AST#primary_type#Left S... | async generateGreeting(
params: GenerationParams,
streamMode: StreamMode = StreamMode.NONE,
onStreamUpdate?: (state: StreamState) => void
): Promise<string> {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[GREETING_DEBUG] Starting generation - isConfigured: ${this.isConfigured}`);
if... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L112-L165 | 0d3af10e6b6d24cf38ae02042f27cff1abd3575a | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets | arkts | 用户数据 | export const mockUser: User = {
id: 1,
nickName: '未登录用户',
phone: '',
avatarUrl: ''
}; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left mockUser : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#p... | export const mockUser: User = {
id: 1,
nickName: '未登录用户',
phone: '',
avatarUrl: ''
}; | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets#L157-L162 | d52d54b1c94f6626e31c0bae69cbc17181c2e812 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM4.ets | arkts | encryptCBC | 加密(CBC模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|CBC|PKCS7、SM4_128|CBC|PKCS5、等)
@returns | static async encryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> {
return SM4.encrypt(data, symKey, ivParams, transformation);
} | AST#method_declaration#Left static async encryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym... | static async encryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> {
return SM4.encrypt(data, symKey, ivParams, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L110-L113 | f5c0bd18fe87ab7fdf81b994fa3306220f090849 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/ui/button/BaseButton.ets | arkts | aboutToAppear | 初始化方法,从全局变量中获取 onClickHandler | aboutToAppear(): void {
this.onClickHandler = tempOnClickHandler;
tempOnClickHandler = undefined; // 清除临时变量
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb... | aboutToAppear(): void {
this.onClickHandler = tempOnClickHandler;
tempOnClickHandler = undefined;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/button/BaseButton.ets#L68-L71 | e07d2084a08f0fe57762c2ff506460a99acb241a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets | arkts | rgbToHex | 将 RGB 颜色值转换为十六进制格式。
@param {number} red - 红色分量,范围为 0-255。
@param {number} green - 绿色分量,范围为 0-255。
@param {number} blue - 蓝色分量,范围为 0-255。
@returns {string} - 返回表示 RGB 颜色的十六进制字符串,格式为 "#RRGGBB"。 | function rgbToHex(red: number, green: number, blue: number): string {
return '#' + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1);
} | AST#function_declaration#Left function rgbToHex AST#parameter_list#Left ( AST#parameter#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left green : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ... | function rgbToHex(red: number, green: number, blue: number): string {
return '#' + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets#L103-L105 | dfebca0e1234ed413c48c149bfd79923b1734228 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/chat/AIAssistantPage.ets | arkts | buildChatArea | 构建聊天区域 | @Builder
buildChatArea() {
Scroll(this.scrollController) {
Column({ space: 16 }) {
ForEach(this.messages, (message: ChatMessage, index: number) => {
this.buildMessageItem(message, index)
})
// 正在输入指示器
if (this.isTyping) {
this.buildTypingIndicator()
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildChatArea AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left AST#... | @Builder
buildChatArea() {
Scroll(this.scrollController) {
Column({ space: 16 }) {
ForEach(this.messages, (message: ChatMessage, index: number) => {
this.buildMessageItem(message, index)
})
if (this.isTyping) {
this.buildTypingIndicator()
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L142-L167 | 6d52967b1619e3813a90c1a3f7328a8bf4f6bd61 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/string_lib_func_001_T.ets | arkts | Introduction 库函数-string_concat | export function string_lib_func_001_T(taint_src : string) {
let t = taint_src.concat("_");
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme... | export function string_lib_func_001_T(taint_src : string) {
let t = taint_src.concat("_");
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_001_T.ets#L7-L10 | c4649fc035a0044bcf5a70b5adee6bacf63bbd51 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 动画配置接口 | export interface AnimationConfig {
duration: number;
easing: string;
delay?: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AnimationConfig AST#object_type#Left { AST#type_member#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left easing : AST#type_annotat... | export interface AnimationConfig {
duration: number;
easing: string;
delay?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L236-L240 | 4d31db56c3a4d4c6353d8612936573e60fb82e03 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Prefix of log. | export const PREFIX = '[ReadingRecorder]'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PREFIX = AST#expression#Left '[ReadingRecorder]' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const PREFIX = '[ReadingRecorder]'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L135-L135 | d64b9ffbb295fe7b01d7c96d2f31bd2230438af4 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/extendableComponent.d.ets | arkts | Defining interface of LifeCycle for custom component and custom dialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export interface LifeCycle {
/**
* aboutToAppear Method.
*
* The aboutToAppear function is executed after a new instance of the custom component is created,
* before its build() function is executed.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicserv... | AST#export_declaration#Left export AST#interface_declaration#Left interface LifeCycle AST#object_type#Left { /**
* aboutToAppear Method.
*
* The aboutToAppear function is executed after a new instance of the custom component is created,
* before its build() function is executed.
*
* @sysca... | export interface LifeCycle {
aboutToAppear(): void {} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/extendableComponent.d.ets#L32-L44 | 9fdbd140b3bf4df162cc6b2e46085abe1a185375 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/goods/GoodsNavigator.ets | arkts | toDetail | 跳转到商品详情
@param {number} goodsId - 商品 ID
@returns {void} 无返回值 | static toDetail(goodsId: number): void {
const params: GoodsIdParam = { goodsId };
navigateTo(GoodsRoutes.Detail, params);
} | AST#method_declaration#Left static toDetail AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | static toDetail(goodsId: number): void {
const params: GoodsIdParam = { goodsId };
navigateTo(GoodsRoutes.Detail, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/goods/GoodsNavigator.ets#L16-L19 | de6f95a4dfb2a5b84492b55cc0615dd6e894a659 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtaining the hard drive chip type.
@syscap SystemCapability.Startup.SystemInfo
@since 22
@arkts 1.2 | static get chipType(): string; | AST#method_declaration#Left static get AST#ERROR#Left chip Type AST#ERROR#Right 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#method_declaration#Right | static get chipType(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L486-L486 | f5de36ea032c14d7e4a49815a7549b1bc1b05815 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | save_web_state_to_sandbox | Saves web state of a specific tab to sandbox. Reads the web_state from bunch_of_tabs properties.
So update_web_state() should be called before this function to keep it up-to-date.
@param index The index of tab.
@returns True if saved to disk. False if failed. | save_web_state_to_sandbox(index: number, dir: string): boolean {
// Save to sandbox
return this.Tabs[index].save_web_state_to_sandbox(dir);
} | AST#method_declaration#Left save_web_state_to_sandbox 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 dir : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | save_web_state_to_sandbox(index: number, dir: string): boolean {
return this.Tabs[index].save_web_state_to_sandbox(dir);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L675-L678 | aea6dcc07630e171faf3542caa9e358d3ad48bb6 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/animation/AnimBlink.ets | arkts | 闪烁动画参数类型定义 | export interface BlinkOptions {
set : (opacity: number) => void // 必须:设置透明度的方法(0~1)
times? : number // 可选:闪烁次数(默认 3 次)
duration? : number // 可选:每次闪烁的时间(默认 500ms)
onFinished?: () => void // 可选:动画完成后的回调函数
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BlinkOptions AST#object_type#Left { AST#type_member#Left set : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left opacity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | export interface BlinkOptions {
set : (opacity: number) => void
times? : number
duration? : number
onFinished?: () => void
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/animation/AnimBlink.ets#L4-L9 | 68d75db8f67f8da4888d77e8d1b498350dc27aeb | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ChartModel.ets | arkts | clear | Clears the chart from all data (sets it to null) and refreshes it (by
calling invalidate()). | public clear() {
this.mData = null;
this.mOffsetsCalculated = false;
this.mIndicesToHighlight = null;
if (this.mChartTouchListener) {
this.mChartTouchListener.setLastHighlighted();
}
this.invalidate();
} | AST#method_declaration#Left public clear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mData AST#member_expression#Right = A... | public clear() {
this.mData = null;
this.mOffsetsCalculated = false;
this.mIndicesToHighlight = null;
if (this.mChartTouchListener) {
this.mChartTouchListener.setLastHighlighted();
}
this.invalidate();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L249-L257 | befdaa9086cb7f816e344889912e08c5001746e0 | gitee |
buqiuz/game-puzzle.git | 605dc0fac0738466db308a8ba255b5e9094c52ac | entry/src/main/ets/pages/Login.ets | arkts | jumpToPrivacyWebView | 跳转华为账号用户认证协议页,该页面需在工程main_pages.json文件配置 | jumpToPrivacyWebView() {
router.pushUrl({
// 在工程main_pages.json文件配置跳转页,具体可参考AccountKit开发指南使用华为账号一键登录WebPage示例代码
url: 'pages/WebPage',
params: {
isFromDialog: true,
url: QuickLoginButtonComponent.USER_AUTHENTICATION_PROTOCOL,
}
}, (err) => {
if (err) {
hilog.... | AST#method_declaration#Left jumpToPrivacyWebView 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 router AST#expression#Right . pushUrl AST#m... | jumpToPrivacyWebView() {
router.pushUrl({
url: 'pages/WebPage',
params: {
isFromDialog: true,
url: QuickLoginButtonComponent.USER_AUTHENTICATION_PROTOCOL,
}
}, (err) => {
if (err) {
hilog.error(this.domainId, this.logTag,
`Failed to jumpToPrivacyW... | https://github.com/buqiuz/game-puzzle.git/blob/605dc0fac0738466db308a8ba255b5e9094c52ac/entry/src/main/ets/pages/Login.ets#L133-L147 | 99d9079cae5baf0d1001005f4a2a8ea72f257061 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | PerformanceAnalysis/BptaFramePractice/entry/src/main/ets/components/DiscoverView.ets | arkts | aboutToReuse | ... | aboutToReuse(params: Record<string, Object>): void {
// ...
} | AST#method_declaration#Left aboutToReuse AST#parameter_list#Left ( AST#parameter#Left params : 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 , AST#type_annotatio... | aboutToReuse(params: Record<string, Object>): void {
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaFramePractice/entry/src/main/ets/components/DiscoverView.ets#L54-L56 | b374d25d4e8db0054332e08a1832ce1343a814c1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/swipersmoothvariation/src/main/ets/pages/MainPage.ets | arkts | SwiperSmoothVariationComponent | 功能描述: 在很多应用中,swiper组件每一个page的高度是不一致的,所以需要swiper组件下方页面的高度跟着一起变化。
推荐场景: 页面高度随着swiper高度平滑变化
核心组件:
1. onGestureSwipe
实现步骤:
1. 生成四个Swiper页面,来进行左右滑动,GridBuilderFunction是生成Swiper的page。
2. Swiper组件的回调,通过左右滑动的距离来计算对应的上下位置的变化,在页面跟手滑动过程中,逐帧触发onGestureSwipe回调,swiperDistance发生变化。
3. Swiper组件的回调,用来达到平滑变化的效果,切换动画开始时触发onAnimationSt... | @Component
export struct SwiperSmoothVariationComponent {
// scroller控制器初始化
private gridScroller: Scroller = new Scroller();
private dialog: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample()
});
// swiper的第一个页面数据
private dataPageOne: GridItemInfo[] = [
{ name: $r('... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperSmoothVariationComponent AST#component_body#Left { // scroller控制器初始化 AST#property_declaration#Left private gridScroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_a... | @Component
export struct SwiperSmoothVariationComponent {
private gridScroller: Scroller = new Scroller();
private dialog: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample()
});
private dataPageOne: GridItemInfo[] = [
{ name: $r('app.string.swipersmoothvariation_n... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipersmoothvariation/src/main/ets/pages/MainPage.ets#L104-L173 | 5e8525bf752f456d2cb149e8793b8be76f051a6f | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/GlobalInfoApi.ets | arkts | query | Query globalInfo.
@param callback | query(callback: Function): void {
let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count === 0) {
Logger.info('Global... | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right A... | query(callback: Function): void {
let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count === 0) {
Logger.info('Global... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/GlobalInfoApi.ets#L59-L78 | bc64ff7f26738d0582c0a7a5cc7ee14cfdc3ddb0 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | A class holding tabs in a list which provides methods to operate tabs.
@param no_init Will not set my_id. | constructor(no_init: boolean, storage?: LocalStorage) {
if (no_init) {
this.my_id = '';
return;
}
if (storage) {
this.my_storage = storage;
this.my_id = storage.get('my_window_id') as string;
}
console.log('[Meow][bunch_of_tabs] Init success! ID: ' + this.my_id + '!');
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left no_init : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left storage ? : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST... | constructor(no_init: boolean, storage?: LocalStorage) {
if (no_init) {
this.my_id = '';
return;
}
if (storage) {
this.my_storage = storage;
this.my_id = storage.get('my_window_id') as string;
}
console.log('[Meow][bunch_of_tabs] Init success! ID: ' + this.my_id + '!');
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L45-L55 | 7d0c3224ade03620da40d10ecd98ffd0c4e7af51 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets | arkts | createDeviceManager | Create a device manager. | async createDeviceManager() {
if (this.myDeviceManager !== undefined) {
Logger.info('RemoteDeviceModel', 'createDeviceManager myDeviceManager exist');
return;
}
await new Promise((resolve: (value: Object | PromiseLike<Object>) => void, reject: ((reason?: RejectError) => void)) => {
try {
... | AST#method_declaration#Left async createDeviceManager 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#Right ... | async createDeviceManager() {
if (this.myDeviceManager !== undefined) {
Logger.info('RemoteDeviceModel', 'createDeviceManager myDeviceManager exist');
return;
}
await new Promise((resolve: (value: Object | PromiseLike<Object>) => void, reject: ((reason?: RejectError) => void)) => {
try {
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets#L53-L82 | 2f90927d8e8f49657bee151b354e99c3ab905424 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/common/util/GlobalUtil.ets | arkts | 构造单例对象 | export class GlobalContext {
private constructor() {}
private static instance: GlobalContext;
private objectsMap = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.instanc... | AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext 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 AST#property_declarat... | export class GlobalContext {
private constructor() {}
private static instance: GlobalContext;
private objectsMap = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.instanc... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/common/util/GlobalUtil.ets#L17-L36 | 9fade732877c8621a7014292fd4eec3f1b9aaf6c | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/model/DataModel.ets | arkts | addData | Change a single piece of data. | public addData(index: number, data: VideoData): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addData 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 data : AST#type_annotation#Left AST#primary_type#Left VideoData AST#primary_type... | public addData(index: number, data: VideoData): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/DataModel.ets#L113-L116 | 1c7e7bc018c6c2434316eaca6aa8d2ebaf2dfa8a | gitee |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | @huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets | arkts | set | 设置消息监听器,用于接收平台下发的消息
此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理
@param rawDeviceMessageListener 消息监听器 | set rawDeviceMessageListener(value: RawDeviceMessageListener | null); | AST#method_declaration#Left set AST#ERROR#Left rawDeviceMessage List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RawDeviceMessageListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_... | set rawDeviceMessageListener(value: RawDeviceMessageListener | null); | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/@huaweicloud/iot-device-sdk/src/main/ets/client/DeviceClient.d.ets#L64-L64 | 8b72737e6da951bf85144ed26a19b695b8bdd61a | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/view/TooltipComponent.ets | arkts | hide | 隐藏提示 | private hide(): void {
this.getUIContext().animateTo({
duration: 200,
curve: Curve.EaseIn
}, () => {
this.tipOpacity = 0;
this.tipScale = 0.9;
});
setTimeout(() => {
this.show = false;
}, 200);
} | AST#method_declaration#Left private hide 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#expression#... | private hide(): void {
this.getUIContext().animateTo({
duration: 200,
curve: Curve.EaseIn
}, () => {
this.tipOpacity = 0;
this.tipScale = 0.9;
});
setTimeout(() => {
this.show = false;
}, 200);
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/TooltipComponent.ets#L78-L90 | 5fe2dd2e606eb8405d1c460438271e48bba1a01c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | getGcmParamsSpec | 获取转换GcmParamsSpec | static getGcmParamsSpec(iv: Uint8Array, aad: Uint8Array, authTag: Uint8Array): cryptoFramework.GcmParamsSpec {
//GCM的authTag在加密时从doFinal结果中获取,在解密时填入init函数的params参数中
let gcmParamsSpec: cryptoFramework.GcmParamsSpec = {
iv: { data: iv },
aad: { data: aad },
authTag: { data: authTag },
algN... | AST#method_declaration#Left static getGcmParamsSpec AST#parameter_list#Left ( AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aad : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#pr... | static getGcmParamsSpec(iv: Uint8Array, aad: Uint8Array, authTag: Uint8Array): cryptoFramework.GcmParamsSpec {
let gcmParamsSpec: cryptoFramework.GcmParamsSpec = {
iv: { data: iv },
aad: { data: aad },
authTag: { data: authTag },
algName: "GcmParamsSpec"
};
return gcmParamsSpec;... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L271-L280 | c9be93c4077c1891690ddaa8359a07c07dfa04cb | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets | arkts | this | 弹出安全设置底部弹窗 | this.securitySettingDialogController.open(); | AST#method_declaration#Left this AST#ERROR#Left . securitySett in gDialogController . open AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right | this.securitySettingDialogController.open(); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets#L129-L129 | 6fb81f4430d0eadf3316fbcd9b395b432580871f | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/param/shared/CardSharedAnimationOptions.ets | arkts | @author: HHBin
@date: 2025/4/28
@desc: 卡片一镜到底 | export class CardSharedAnimationOptions implements INavAnimateOptions {
_isBeforePage: boolean = false;
p: CardSharedAnimationProperties
_navBgColor: ResourceColor | undefined
_IsAdaptImmersive: boolean = false
constructor | AST#export_declaration#Left export AST#ERROR#Left class CardSharedAnimationOptions AST#implements_clause#Left implements INavAnimateOptions AST#implements_clause#Right { AST#property_declaration#Left _isBeforePage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ... | export class CardSharedAnimationOptions implements INavAnimateOptions {
_isBeforePage: boolean = false;
p: CardSharedAnimationProperties
_navBgColor: ResourceColor | undefined
_IsAdaptImmersive: boolean = false
constructor | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/shared/CardSharedAnimationOptions.ets#L12-L18 | 33cf7f3b85e98767c825c717039e33fb821c7174 | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/viewmodel/AgreementViewModel.ets | arkts | onPageEnd | 页面加载完成 | onPageEnd(): void {
this.isLoading = false;
} | AST#method_declaration#Left onPageEnd AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_e... | onPageEnd(): void {
this.isLoading = false;
} | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/viewmodel/AgreementViewModel.ets#L28-L30 | 69511389caa678e3717ed30cbaec8de3a0a24978 | github |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/pages/CategoryDetailPage.ets | arkts | setImmersiveMode | 设置沉浸式状态栏 | private async setImmersiveMode() {
// 1. 获取当前窗口
window.getLastWindow(this.getUIContext().getHostContext(), async (err: BusinessError, win: window.Window) => {
try {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
// 2.备份原始设置
this.origin... | AST#method_declaration#Left private async setImmersiveMode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 1. 获取当前窗口 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expressio... | private async setImmersiveMode() {
window.getLastWindow(this.getUIContext().getHostContext(), async (err: BusinessError, win: window.Window) => {
try {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
this.originalBarProps = win.getWin... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/pages/CategoryDetailPage.ets#L50-L72 | e14a17152c88c27c1e2e579362fb7793d06ddc31 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/PixelMapUtils.ets | arkts | createPixelMapFromFileSync | 从文件路径创建PixelMap | static createPixelMapFromFileSync(
filePath: string,
options?: image.DecodingOptions
): image.PixelMap | null {
try {
const imageSource : image.ImageSource = image.createImageSource(filePath);
const decodingOptions: image.DecodingOptions = options || {
desiredSize : { width: 0, ... | AST#method_declaration#Left static createPixelMapFromFileSync AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left... | static createPixelMapFromFileSync(
filePath: string,
options?: image.DecodingOptions
): image.PixelMap | null {
try {
const imageSource : image.ImageSource = image.createImageSource(filePath);
const decodingOptions: image.DecodingOptions = options || {
desiredSize : { width: 0, ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PixelMapUtils.ets#L18-L33 | 830ef1736df6517271f332d75b5662bf9c998147 | github |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/dialog/TipsDialog.ets | arkts | initConfirm | ------------------------- 保护、私有方法 protected | private methods ------------------------- | private initConfirm(options: ITipsDialogOptions): ITipsDialogOptions {
if (options.primaryButton) {
options.primaryButton = this.initButton(options, options.primaryButton, false, 0) as ButtonOptions
}
if (options.secondaryButton) {
options.secondaryButton = this.initButton(options, options.secon... | AST#method_declaration#Left private initConfirm AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ITipsDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ITipsD... | private initConfirm(options: ITipsDialogOptions): ITipsDialogOptions {
if (options.primaryButton) {
options.primaryButton = this.initButton(options, options.primaryButton, false, 0) as ButtonOptions
}
if (options.secondaryButton) {
options.secondaryButton = this.initButton(options, options.secon... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/TipsDialog.ets#L22-L31 | 986abe7a7076af0cb227778a5bb4b15acb6d7ff6 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/Base64Encoding.ets | arkts | Base64编码实现
Base64是一种基于64个可打印字符来表示二进制数据的表示方法 | export class Base64Encoding {
private static readonly BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
private static readonly BASE64_PADDING = '=';
/**
* 将字符串编码为Base64
* @param text 要编码的文本
* @returns Base64编码后的字符串
*/
static encode(text: string): string {
if (!... | AST#export_declaration#Left export AST#class_declaration#Left class Base64Encoding AST#class_body#Left { AST#property_declaration#Left private static readonly BASE64_CHARS = AST#expression#Left 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' AST#expression#Right ; AST#property_declaration#Right AST#p... | export class Base64Encoding {
private static readonly BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
private static readonly BASE64_PADDING = '=';
static encode(text: string): string {
if (!text) {
return '';
}
let result = '';
let i = 0;
const le... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/Base64Encoding.ets#L5-L81 | dc20a7b59df071455158306c0fbb10d81913d1bb | github | |
Million-mo/tree-sitter-arkts.git | 2fd0ad75e2d848709edcf4be038f27b178114ef6 | examples/custom_builders.ets | arkts | fancyText | 全局Extend函数 | @Extend(Text)
function fancyText(size: number, color: ResourceColor, weight: FontWeight) {
.fontSize(size)
.fontColor(color)
.fontWeight(weight)
.textAlign(TextAlign.Center)
.padding(8)
.borderRadius(4)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function fancyText AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#para... | @Extend(Text)
function fancyText(size: number, color: ResourceColor, weight: FontWeight) {
.fontSize(size)
.fontColor(color)
.fontWeight(weight)
.textAlign(TextAlign.Center)
.padding(8)
.borderRadius(4)
} | https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/custom_builders.ets#L53-L61 | 97cd4cc8ad18f7bd49987dadde056fab6a6ebdfc | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/AudioUtil.ets | arkts | startRecording | 启动音频采集
@returns | static async startRecording(): Promise<string> {
if (AudioUtil.audioCapturer !== undefined) {
let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED];
if (stateGroup.indexOf((AudioUtil.audioCapturer as audio.AudioCapturer).state.valueOf()) === -1... | AST#method_declaration#Left static async startRecording 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 startRecording(): Promise<string> {
if (AudioUtil.audioCapturer !== undefined) {
let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED];
if (stateGroup.indexOf((AudioUtil.audioCapturer as audio.AudioCapturer).state.valueOf()) === -1... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/AudioUtil.ets#L74-L87 | cb3aca3c91364e6aef5fd8217e7fcf14cc91c952 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | encryptSegment | 加密,分段,异步
@param data 加密或者解密的数据。data不能为null。
@param pubKey 指定加密公钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。
@param len 自定义的数据拆分长度。
@returns | static async encryptSegment(dataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1', len: number = 64): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.CryptoMode.EN... | AST#method_declaration#Left static async encryptSegment AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#... | static async encryptSegment(dataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1', len: number = 64): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cipher.init(cryptoFramework.CryptoMode.EN... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L83-L101 | 7a37fa0b9155e9fdfffb3aed18f7499f6636a288 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/model/CommentModel.ets | arkts | TextAttribute should be insert by ui-plugins | export class Comment {
public id: number = 0;
public name: string = '';
public avatar: ResourceStr = '';
public time: string = '';
public comment: string = '';
public images: Array<ResourceStr> = new Array<ResourceStr>();
} | AST#export_declaration#Left export AST#class_declaration#Left class Comment AST#class_body#Left { AST#property_declaration#Left public id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right... | export class Comment {
public id: number = 0;
public name: string = '';
public avatar: ResourceStr = '';
public time: string = '';
public comment: string = '';
public images: Array<ResourceStr> = new Array<ResourceStr>();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/model/CommentModel.ets#L17-L24 | 823ffc8fba7709a407134f6a0fe12315ab3f299a | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets | arkts | totalCount | 获取数组长度 | public totalCount(): number {
return this.originDataArray.length;
} | AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | public totalCount(): number {
return this.originDataArray.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets#L27-L29 | 33e0079dbeea4b2e24df3f96a260e2cad5b3eb9f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/I18nManager.ets | arkts | loadCurrentLanguageTranslations | 加载当前语言的翻译 | private async loadCurrentLanguageTranslations(): Promise<void> {
try {
// 如果当前语言的翻译未加载,则加载
if (!this.translations.has(this.currentLanguage)) {
await this.loadLanguageTranslations(this.currentLanguage);
}
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,... | AST#method_declaration#Left private async loadCurrentLanguageTranslations AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_anno... | private async loadCurrentLanguageTranslations(): Promise<void> {
try {
if (!this.translations.has(this.currentLanguage)) {
await this.loadLanguageTranslations(this.currentLanguage);
}
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed t... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L690-L700 | 63a17b49e8f3b86660d8ed07d62a3faf8e613a74 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | buildDownloadsTab | 下载页签 | @Builder
buildDownloadsTab() {
Column() {
// 下载中部分
if (this.downloadingEpisodes.length > 0) {
Text('下载中')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.width('100%')
.padding({ left: 16, top: 12, bottom: 8 })
List({ space: 8 }) {
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDownloadsTab 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 { // 下载中部分 AS... | @Builder
buildDownloadsTab() {
Column() {
if (this.downloadingEpisodes.length > 0) {
Text('下载中')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.width('100%')
.padding({ left: 16, top: 12, bottom: 8 })
List({ space: 8 }) {
ForEa... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L753-L1012 | f83d93df6ff64df6f1316a7ebda8542417bb5c4a | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | common/src/main/ets/util/DeviceUtils.ets | arkts | 设备信息工具
@since 2022-06-06 | export namespace DeviceUtils {
/**
* 获取设备类型
*
* @return 设备类型
*/
export function getDeviceType(): string {
return deviceInfo.deviceType;
} | AST#export_declaration#Left export AST#ERROR#Left namespace DeviceUtils { /**
* 获取设备类型
*
* @return 设备类型
*/ export AST#ERROR#Right AST#function_declaration#Left function getDeviceType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | export namespace DeviceUtils {
export function getDeviceType(): string {
return deviceInfo.deviceType;
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/util/DeviceUtils.ets#L24-L32 | 3002548b28412e97b7784839a08f72df8e299675 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets | arkts | retryRequest | 重试请求
@returns {void} 无返回值 | retryRequest(): void {
this.uiState = BaseNetWorkListUiState.LOADING;
this.currentPage = 1;
this.loadListData();
} | AST#method_declaration#Left retryRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#membe... | retryRequest(): void {
this.uiState = BaseNetWorkListUiState.LOADING;
this.currentPage = 1;
this.loadListData();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L130-L134 | 0d528ba73595c26cae98b474bf2ced3283747bf8 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/common/constant/CommonConstants.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 CommonConstants {
/**
* Slider min.
*/
static readonly SLIDER_MIN: number = 1;
/**
* Slider max.
*/
static readonly SLIDER_MAX: number = 100;
/**
* Slider step.
*/
static readonly SLIDER_STEP: number = 1;
/**
* Adjust slider value.
*/
static readonly ADJUST_SLIDER_VA... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Slider min.
*/ AST#property_declaration#Left static readonly SLIDER_MIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 A... | export class CommonConstants {
static readonly SLIDER_MIN: number = 1;
static readonly SLIDER_MAX: number = 100;
static readonly SLIDER_STEP: number = 1;
static readonly ADJUST_SLIDER_VALUE: number = 100;
static readonly TASK_MIN: number = 1;
static readonly TASK_MAX: number = 20;
sta... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/common/constant/CommonConstants.ets#L16-L83 | 17797c5c6e4a0df32872f889d4184f0977b12fac | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/constants/MsgSendStatus.ets | arkts | 消息的发送状态常量. | export default class MsgSendStatus {
/** 消息发送中 */
static readonly sending: number = 0;
/** 消息已被对方收到(我方已收到QoS应答包) */
static readonly beReceived: number = 1;
/** 消息发送失败(在QoS超时重传的时间内未收到应答包) */
static readonly sendFaild: number = 2;
} | AST#export_declaration#Left export default AST#class_declaration#Left class MsgSendStatus AST#class_body#Left { /** 消息发送中 */ AST#property_declaration#Left static readonly sending : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expressi... | export default class MsgSendStatus {
static readonly sending: number = 0;
static readonly beReceived: number = 1;
static readonly sendFaild: number = 2;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/constants/MsgSendStatus.ets#L5-L12 | 3741273b03cbed44eddf3f08ab91a79386ee3b5b | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FramedRendering/entry/src/main/ets/view/DateItemView.ets | arkts | aboutToDisappear | [StartExclude Case2] | aboutToDisappear(): void {
if (allDisplaySyncArray.length > 0) {
allDisplaySyncArray.forEach((displaySync: displaySync.DisplaySync) => {
displaySync.stop();
});
}
} | 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_... | aboutToDisappear(): void {
if (allDisplaySyncArray.length > 0) {
allDisplaySyncArray.forEach((displaySync: displaySync.DisplaySync) => {
displaySync.stop();
});
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FramedRendering/entry/src/main/ets/view/DateItemView.ets#L115-L121 | 347940d732246c049e2704c915af14aee0933b31 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/models/ContactModel.ets | arkts | removeTag | 移除标签 | removeTag(tag: string): Contact {
const index = this.contact.tags.indexOf(tag);
if (index > -1) {
this.contact.tags.splice(index, 1);
this.contact.updatedAt = new Date().toISOString();
}
return this.getContact();
} | AST#method_declaration#Left removeTag AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right A... | removeTag(tag: string): Contact {
const index = this.contact.tags.indexOf(tag);
if (index > -1) {
this.contact.tags.splice(index, 1);
this.contact.updatedAt = new Date().toISOString();
}
return this.getContact();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L249-L256 | 4128a6086b98507829ada5e84a3104b45eb61da7 | github |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/ClockArea.ets | arkts | aboutToDisappear | 页面退出时暂停绘制任务。 | public aboutToDisappear(): void {
clearInterval(this.drawInterval);
} | AST#method_declaration#Left public 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#ui_custom_component_statement#Left clearInterval ( AST#expression#Left AST#... | public aboutToDisappear(): void {
clearInterval(this.drawInterval);
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ClockArea.ets#L43-L45 | 35f94605bae59585a95e98b9e343f9d05b351b34 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getMainWindow | 获取主窗口 | static getMainWindow(): window.Window {
if (!AppUtils.windowStage) {
LogUtils.error('AppUtils',
"windowStage为空,请在UIAbility的onWindowStageCreate方法中调用AppUtils的init方法初始化!")
}
return AppUtils.windowStage.getMainWindowSync()
} | AST#method_declaration#Left static getMainWindow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Le... | static getMainWindow(): window.Window {
if (!AppUtils.windowStage) {
LogUtils.error('AppUtils',
"windowStage为空,请在UIAbility的onWindowStageCreate方法中调用AppUtils的init方法初始化!")
}
return AppUtils.windowStage.getMainWindowSync()
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L48-L54 | a1c47d079586d7bbc908aa90923571603006ee71 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | initImmersiveWindow | 初始化沉浸式窗口
@param {window.Window} windowClass - 当前窗口
@returns {void} 无返回值 | private initImmersiveWindow(windowClass: window.Window): void {
const isLayoutFullScreen: boolean = true;
windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => {
console.info("Succeeded in setting the window layout to full-screen mode.");
}).catch((err: BusinessError) => {
console... | AST#method_declaration#Left private initImmersiveWindow AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Rig... | private initImmersiveWindow(windowClass: window.Window): void {
const isLayoutFullScreen: boolean = true;
windowClass.setWindowLayoutFullScreen(isLayoutFullScreen).then(() => {
console.info("Succeeded in setting the window layout to full-screen mode.");
}).catch((err: BusinessError) => {
console... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/adapter/WindowAdapter.ets#L92-L99 | 72570f7a27eda2e3eda6c61184141d998e00bc72 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.EditableTitleBar.d.ets | arkts | EditableTitleBar | Declaration of the editable title bar.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the editable title bar.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @Component
export declare struct EditableTitleBar {
/**
* Style of the left icon.
* @type { EditableLeftIconType }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Style of the left icon.
* @type { EditableLeftIconType }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @ato... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct EditableTitleBar AST#component_body#Left { /**
* Style of the left icon.
* @type { EditableLeftIconType }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
... | @Component
export declare struct EditableTitleBar {
leftIconStyle: EditableLeftIconType;
imageItem?: EditableTitleBarItem;
title: ResourceStr;
subtitle?: ResourceStr;
isSaveIconRequired: boolean;
menuItems?: Array<EditableTitleBarMenuItem>;
onSave?: () => void;
... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.EditableTitleBar.d.ets#L255-L407 | bb0b5808de0e2fc47a85addadd3b00f0ffbf78f1 | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/StickyDemo/entry/src/main/ets/pages/Index.ets | arkts | connect2Server | 连接服务端 | async connect2Server(tcpSocket: socket.TCPSocket) {
//本地地址
let serverAddress = { address: this.serverIp, port: this.serverPort, family: 1 }
await tcpSocket.connect({ address: serverAddress })
.then(() => {
this.msgHistory = 'connect success ' + "\r\n";
})
.catch((e) => {
t... | AST#method_declaration#Left async connect2Server AST#parameter_list#Left ( AST#parameter#Left tcpSocket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TCPSocket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST... | async connect2Server(tcpSocket: socket.TCPSocket) {
let serverAddress = { address: this.serverIp, port: this.serverPort, family: 1 }
await tcpSocket.connect({ address: serverAddress })
.then(() => {
this.msgHistory = 'connect success ' + "\r\n";
})
.catch((e) => {
this.ms... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/StickyDemo/entry/src/main/ets/pages/Index.ets#L140-L151 | 2492d90caa9d23480e5b27d2ceaadb1144831707 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | encryptGCMSegment | 加密(GCM模式)分段,异步
@param dataBlob 加密或者解密的数据。dataBlob不能为null。
@param key 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES128|GCM|PKCS7、AES192|GCM|PKCS7、AES256|GCM|PKCS7、、等)。
@param len 自定义的数据拆分长度。
@returns | static async encryptGCMSegment(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7',
len: number = 128): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cip... | 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, transformation: string = 'AES256|GCM|PKCS7',
len: number = 128): Promise<cryptoFramework.DataBlob> {
let cipher = cryptoFramework.createCipher(transformation);
await cip... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L269-L287 | db76751bef9d81ccc3e3ebda819e83912a81feb0 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets | arkts | getMonthViewData | 获取指定月份数据 | getMonthViewData(year: number, month: number) {
this.monthDays = [...TimeUtils.byMonthDayForYear(year, month)];
} | AST#method_declaration#Left getMonthViewData AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | getMonthViewData(year: number, month: number) {
this.monthDays = [...TimeUtils.byMonthDayForYear(year, month)];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets#L59-L61 | 44cff76203a99323c1bece65b3175946a2b45ab2 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SettingsPage.ets | arkts | updateNotificationEnabled | 更新通知设置 | private async updateNotificationEnabled(enabled: boolean): Promise<void> {
try {
await this.settingsService.updateNotificationSettings({ enabled });
this.settings = await this.settingsService.getSettings();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to... | AST#method_declaration#Left private async updateNotificationEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Le... | private async updateNotificationEnabled(enabled: boolean): Promise<void> {
try {
await this.settingsService.updateNotificationSettings({ enabled });
this.settings = await this.settingsService.getSettings();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L94-L101 | 6ef774c98a20cfb3fa047620c46ff4ad20f3dcb9 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/ListModel.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class ListModel {
title: string;
function: Function;
value: string;
constructor(title: string, func: Function, value: string = '') {
this.title = title;
this.function = func;
this.value = value;
}
setValue(value: string) {
this.value = value;
}
getValue() {
if (this.functio... | AST#export_declaration#Left export AST#class_declaration#Left class ListModel AST#class_body#Left { AST#property_declaration#Left title : 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 function : AST#t... | export class ListModel {
title: string;
function: Function;
value: string;
constructor(title: string, func: Function, value: string = '') {
this.title = title;
this.function = func;
this.value = value;
}
setValue(value: string) {
this.value = value;
}
getValue() {
if (this.functio... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/model/ListModel.ets#L16-L38 | c60425e50262eed231169b33f186c613fb5ac309 | gitee | |
Delsin-Yu/JustPDF.git | d53f566e02820dac46e1752151750144acbed50a | entry/src/main/ets/components/PageInfo.ets | arkts | releaseThumbnail | Releases a reference to the thumbnail. When the reference count reaches zero,
the PixelMap is released and any pending thumbnail task is cancelled.
Used to free memory when the thumbnail scrolls out of view. | public releaseThumbnail(): void {
// Decrement reference count
this.thumbnailRefCount--;
hilog.warn(0, 'PDFView', `页面 ${this.localPageIndex} 缩略图引用计数减少到 ${this.thumbnailRefCount}`);
// Only evict when no more references
if (this.thumbnailRefCount > 0) {
return;
}
// Ensure ref count d... | AST#method_declaration#Left public releaseThumbnail 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 { // Decrement reference count AST#statement#Left AST#expression_statement#Left AST#exp... | public releaseThumbnail(): void {
this.thumbnailRefCount--;
hilog.warn(0, 'PDFView', `页面 ${this.localPageIndex} 缩略图引用计数减少到 ${this.thumbnailRefCount}`);
if (this.thumbnailRefCount > 0) {
return;
}
this.thumbnailRefCount = 0;
if (this.pageThumbnailTask) {
try {
... | https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L230-L264 | f3d244e47c34c392cab60bfedf0f105f50c2c1e5 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | get_new_tab_url | Gets the new tab url.
@returns The new_tab_url. | get_new_tab_url() {
return bunch_of_tabs.new_tab_url;
} | AST#method_declaration#Left get_new_tab_url AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_tabs AST#expression#Right . new_tab_url AST#member_expression#Right ... | get_new_tab_url() {
return bunch_of_tabs.new_tab_url;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L243-L245 | bc76099078d04e288e667ef69d40bccc39562604 | gitee |
gouhaoshuang/arkts-booking-software.git | e0254dae0c4cfd3d43c4e3970528d97136fcc69b | demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | alertDialog | Alert dialog dialog | alertDialog(context: Context.UIAbilityContext) {
AlertDialog.show({
message: "当前数据未保存,是否离开?",
alignment: DialogAlignment.Bottom,
offset: {
dx: 0,
dy: CommonConstants.DY_OFFSET
},
primaryButton: {
value: '取消',
action: () => {
Logger.info(CommonC... | AST#method_declaration#Left alertDialog AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Context . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bu... | alertDialog(context: Context.UIAbilityContext) {
AlertDialog.show({
message: "当前数据未保存,是否离开?",
alignment: DialogAlignment.Bottom,
offset: {
dx: 0,
dy: CommonConstants.DY_OFFSET
},
primaryButton: {
value: '取消',
action: () => {
Logger.info(CommonC... | https://github.com/gouhaoshuang/arkts-booking-software.git/blob/e0254dae0c4cfd3d43c4e3970528d97136fcc69b/demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets#L28-L51 | 676dfbe3fcfac7edcdd6410a2bafff6493c19307 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets | arkts | isEnabled | Returns true if this comonent is enabled (should be drawn), false if not.
@return | public isEnabled(): boolean {
return this.mEnabled;
} | AST#method_declaration#Left public isEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | public isEnabled(): boolean {
return this.mEnabled;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L174-L176 | dc8a17eed866329142eac795cda6972e4527eab5 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets | arkts | Declare type OperateIcon
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare type OperateIcon
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class OperateIcon {
/**
* The content of text or the address of icon.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* The content of text or the address of icon.
* @type { ResourceStr }.
* @syscap SystemCapability.A... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class OperateIcon AST#class_body#Left { /**
* The content of text or the address of icon.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* The conte... | export declare class OperateIcon {
value: ResourceStr;
action?: () => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L141-L170 | 03e0d69ea526e63325cb1b9d3936ea26ef0c640b | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ImageViewer/entry/src/main/ets/constants/ImageViewerConstants.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class ImageViewerConstants {
// 缩放动画的持续时间
public static readonly ANIMATE_DURATION: number = 300;
// swiper中缓存图片的数量
public static readonly SWIPER_CACHE_COUNT: number = 2;
} | AST#export_declaration#Left export AST#class_declaration#Left class ImageViewerConstants AST#class_body#Left { // 缩放动画的持续时间 AST#property_declaration#Left public static readonly ANIMATE_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left... | export class ImageViewerConstants {
public static readonly ANIMATE_DURATION: number = 300;
public static readonly SWIPER_CACHE_COUNT: number = 2;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/constants/ImageViewerConstants.ets#L16-L21 | 42329daad6bff919210cea2e2651f8a85ded7542 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets | arkts | startSandboxApp | 启动沙箱应用 | startSandboxApp(): void {
let want: Want = {
bundleName: this.sandboxBundleName,
abilityName: this.sandboxAbilityName,
uri: this.linkFilePath,
parameters: {
'linkFileName': {
'name': this.linkFileName
},
'uri': this.linkFilePath,
'dlpUri': {
... | AST#method_declaration#Left startSandboxApp AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left want : AST#... | startSandboxApp(): void {
let want: Want = {
bundleName: this.sandboxBundleName,
abilityName: this.sandboxAbilityName,
uri: this.linkFilePath,
parameters: {
'linkFileName': {
'name': this.linkFileName
},
'uri': this.linkFilePath,
'dlpUri': {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L183-L201 | 43d2b7644a9de561cc2d8bdd0b73e2a03a6d4a18 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundHelper.ets | arkts | 字符串扩展方法 | export class CSoundHelper {
/**
* 检查声音缓存是否存在
* @param text 要检查的文本
* @returns 是否存在缓存
*/
static async isSoundCacheExists(text: string): Promise<boolean> {
return await CSoundManager.shared.isCSoundExistsInCache(text)
}
/**
* 启动下载或生成声音
* @param text 要处理的文本
* @returns 声音数据或null
*/
sta... | AST#export_declaration#Left export AST#class_declaration#Left class CSoundHelper AST#class_body#Left { /**
* 检查声音缓存是否存在
* @param text 要检查的文本
* @returns 是否存在缓存
*/ AST#method_declaration#Left static async isSoundCacheExists AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#prima... | export class CSoundHelper {
static async isSoundCacheExists(text: string): Promise<boolean> {
return await CSoundManager.shared.isCSoundExistsInCache(text)
}
static async startDownloadOrGenerateSound(text: string): Promise<CDBSound | null> {
return await CSoundManager.shared.getSound(text, true, tr... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Manager/CSoundHelper.ets#L5-L68 | 50b264e97c5abaad8a7c577e03abc6a8baca9bca | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isExternal | 检查是否为native External类型。
@param value
@returns | static isExternal(value: Object): boolean {
return new util.types().isExternal(value);
} | AST#method_declaration#Left static isExternal 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_ty... | static isExternal(value: Object): boolean {
return new util.types().isExternal(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L289-L291 | 435318e97bdb4d58672764ad259b76163ed30299 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets | arkts | wordIds | 获取此 DBPlan 的所有 wordIds(可指定 pieceNo) | async wordIds(pieceNo?: number): Promise<number[]> {
const pieces = await this.dbPieces();
if (pieceNo != null) {
return pieces.filter(p => p.pieceNo === pieceNo).map(p => p.wordId ?? 0).filter(id => id > 0);
}
return pieces.map(p => p.wordId ?? 0).filter(id => id > 0);
} | AST#method_declaration#Left async wordIds AST#parameter_list#Left ( AST#parameter#Left pieceNo ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | async wordIds(pieceNo?: number): Promise<number[]> {
const pieces = await this.dbPieces();
if (pieceNo != null) {
return pieces.filter(p => p.pieceNo === pieceNo).map(p => p.wordId ?? 0).filter(id => id > 0);
}
return pieces.map(p => p.wordId ?? 0).filter(id => id > 0);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/DBPlanHelper.ets#L44-L50 | 325fe4bb3f2038ecad372ded81bbc58988fedbd3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | offChange | 取消订阅数据变更。
@param callback 需要取消的回调函数,不填写则全部取消。
@param preferenceName 实例的名称。 | static offChange(callback?: Callback<string>, preferenceName: string = PreferencesUtil.defaultPreferenceName) {
let preferences = PreferencesUtil.getPreferencesSync(preferenceName); //获取实例
if (callback) {
preferences.off('change', callback);
} else {
preferences.off('change');
}
} | AST#method_declaration#Left static offChange AST#parameter_list#Left ( AST#parameter#Left callback ? : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type... | static offChange(callback?: Callback<string>, preferenceName: string = PreferencesUtil.defaultPreferenceName) {
let preferences = PreferencesUtil.getPreferencesSync(preferenceName);
if (callback) {
preferences.off('change', callback);
} else {
preferences.off('change');
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L283-L290 | 3f85970d959623effbe3e85e5a84aabde15f9eab | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/MediaManager.ets | arkts | initializeMediaManager | 初始化多媒体管理器 | private async initializeMediaManager(): Promise<void> {
try {
// 初始化相册访问助手
this.photoAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
// 初始化相机管理器
this.cameraManager = camera.getCameraManager(globalThis.context);
// 初始化图片打包器
this.imagePacker... | AST#method_declaration#Left private async initializeMediaManager AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Ri... | private async initializeMediaManager(): Promise<void> {
try {
this.photoAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context);
this.cameraManager = camera.getCameraManager(globalThis.context);
this.imagePackerApi = image.createImagePacker();
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L129-L144 | d4c281b821d9cd610bcfd1e3e5686920bf846afa | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ProgressButtonV2.d.ets | arkts | ProgressButtonV2Color | Declare ProgressButtonV2 Color.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@crossplatform
@since 18 | @ObservedV2
export declare class ProgressButtonV2Color {
/**
* Set progress color of the ProgressButtonV2.
*
* @type { ?ColorMetrics }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @crossplatform
* @since 18
*/
@Trace progressColor?: ColorMetrics;
/**
* Set border col... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class ProgressButtonV2Color AST#class_body#Left { /**
* Set progress color of the ProgressButtonV2.
*
* @type { ?ColorMetrics }.
* @syscap SystemCapability.ArkUI.ArkUI.Full... | @ObservedV2
export declare class ProgressButtonV2Color {
@Trace progressColor?: ColorMetrics;
@Trace borderColor?: ColorMetrics;
@Trace textColor?: ColorMetrics;
@Trace backgroundColor?: ColorMetrics;
constructor(options: ProgressButtonV2ColorOptions);
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ProgressButtonV2.d.ets#L116-L172 | cc8b4d6609c955268156c7e5977d513a93420684 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/database/DatabaseService.ets | arkts | recordSentGreeting | 记录发送的祝福语
@param contactId 联系人ID
@param greetingContent 祝福内容
@param occasion 场合 | async recordSentGreeting(contactId: number, greetingContent: string, occasion: string): Promise<number> {
this.checkInitialization();
const greetingHistory: GreetingHistoryEntity = {
contact_id: contactId,
greeting_content: greetingContent,
occasion: occasion,
sent_at: new Date().toISOS... | AST#method_declaration#Left async recordSentGreeting AST#parameter_list#Left ( AST#parameter#Left contactId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left greetingContent : AST#type_annotation#Left AST#primary_type#Left s... | async recordSentGreeting(contactId: number, greetingContent: string, occasion: string): Promise<number> {
this.checkInitialization();
const greetingHistory: GreetingHistoryEntity = {
contact_id: contactId,
greeting_content: greetingContent,
occasion: occasion,
sent_at: new Date().toISOS... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L242-L254 | 1d68d6b4aae7a9396e050e4cb7206f2ff9e86069 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | changeMonth | 切换月份 | private async changeMonth(offset: number): Promise<void> {
const newDate = new Date(this.currentDate);
newDate.setMonth(newDate.getMonth() + offset);
this.currentDate = newDate;
await this.loadCalendarData();
} | AST#method_declaration#Left private async changeMonth AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t... | private async changeMonth(offset: number): Promise<void> {
const newDate = new Date(this.currentDate);
newDate.setMonth(newDate.getMonth() + offset);
this.currentDate = newDate;
await this.loadCalendarData();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L158-L163 | d88be95b1e31a56f309bbab3d8b24a28ecc1292a | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineRadarDataSet.ets | arkts | private mShowFillLine: boolean = true; | constructor(yVals: JArrayList<T> | null, label: string) {
super(yVals, label);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left yVals : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Righ... | constructor(yVals: JArrayList<T> | null, label: string) {
super(yVals, label);
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineRadarDataSet.ets#L55-L57 | aa38045cba68d6829ebab1844d2012a0ab04ea3f | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取梦想下的任务列表
@param dreamId 梦想ID
@returns 任务列表 | export function getTasksByDreamId(dreamId: number): Promise<Task[]> {
try {
console.info(`获取梦想任务列表, dreamId: ${dreamId}`);
return request<Task[]>(RequestMethod.GET, `/tasks/dream/${dreamId}`);
} catch (error) {
const errorMsg = `获取梦想任务列表失败: ${error instanceof Error ? error.message : String(error)}`;
... | AST#export_declaration#Left export AST#function_declaration#Left function getTasksByDreamId AST#parameter_list#Left ( AST#parameter#Left dreamId : 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#L... | export function getTasksByDreamId(dreamId: number): Promise<Task[]> {
try {
console.info(`获取梦想任务列表, dreamId: ${dreamId}`);
return request<Task[]>(RequestMethod.GET, `/tasks/dream/${dreamId}`);
} catch (error) {
const errorMsg = `获取梦想任务列表失败: ${error instanceof Error ? error.message : String(error)}`;
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L677-L686 | 9aae4cad37d7cd23d935fdaed659d7ca1a9e6577 | github | |
IceTeacher/DrawingBook.git | c101a1b904388fcfa72de1ff402307bb9036b68b | entry/src/main/ets/pages/BookDetailPage.ets | arkts | createAvPlayer | 创建音频对象 | async createAvPlayer(url: string) {
//切换资源时 销毁之前的音频对象
if (this.avPlayer) {
this.avPlayer.release()
}
//创建音频管理对象
let avPlayer: media.AVPlayer = await media.createAVPlayer();
//监听状态变化事件
avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
switch (s... | AST#method_declaration#Left async createAvPlayer AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { //切换资源时 销毁之前的音频对象 AST#statement#Left AST#if_statement... | async createAvPlayer(url: string) {
if (this.avPlayer) {
this.avPlayer.release()
}
let avPlayer: media.AVPlayer = await media.createAVPlayer();
avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
switch (state) {
case 'idle':
... | https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/pages/BookDetailPage.ets#L110-L128 | 185a1cb0af4a6068fd80c1cc38946d366a572f98 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | 完整农历系统设计.ets | arkts | solarToLunar | 🎯 公历转农历 (全新算法)
基于权威数据库的直接查表转换 | public static solarToLunar(solarYear: number, solarMonth: number, solarDay: number): LunarDateInfo {
// 输入验证
if (!Number.isInteger(solarYear) || !Number.isInteger(solarMonth) || !Number.isInteger(solarDay)) {
throw new Error('日期参数必须为整数');
}
if (solarMonth < 1 || solarMonth > 12 || solarDay < 1 ||... | AST#method_declaration#Left public static solarToLunar AST#parameter_list#Left ( AST#parameter#Left solarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left solarMonth : AST#type_annotation#Left AST#primary_type#Left numb... | public static solarToLunar(solarYear: number, solarMonth: number, solarDay: number): LunarDateInfo {
if (!Number.isInteger(solarYear) || !Number.isInteger(solarMonth) || !Number.isInteger(solarDay)) {
throw new Error('日期参数必须为整数');
}
if (solarMonth < 1 || solarMonth > 12 || solarDay < 1 || solarD... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L271-L330 | 2d33a6dd9092c91039765519dd7cfb12f2c60398 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWarmPlayerView.ets | arkts | onPlayerError | 播放器播放失败事件 | onPlayerError(error: VHErrorInfo) {
if(error.code == VHConstants.VH_PLAY_CURRENT_DEF_FAILED){
//没有可用的清晰度,重新进行播放。
this.vodPlayer?.startPlayWithRecordId(this.currentPlayId,this.player_config?.default_definition!);
}else if(error.code == VHConstants.VH_PLAY_STREAM_FAILED || error.code == VHConstants.V... | AST#method_declaration#Left onPlayerError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left VHErrorInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_st... | onPlayerError(error: VHErrorInfo) {
if(error.code == VHConstants.VH_PLAY_CURRENT_DEF_FAILED){
this.vodPlayer?.startPlayWithRecordId(this.currentPlayId,this.player_config?.default_definition!);
}else if(error.code == VHConstants.VH_PLAY_STREAM_FAILED || error.code == VHConstants.VH_NETWORK_ERROR ||... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L117-L128 | 8bcc27c981240d4aa0102256570e54c9250147c4 | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/CommonModel.ets | arkts | Topic Information List. | export class TopicInfoList {
topicInfo: TopicInfo[];
title: ResourceStr;
topicId: string;
constructor(topicInfo: TopicInfo[], title: ResourceStr, topicId: string) {
this.topicInfo = topicInfo;
this.title = title;
this.topicId = topicId;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class TopicInfoList AST#class_body#Left { AST#property_declaration#Left topicInfo : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TopicInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declarat... | export class TopicInfoList {
topicInfo: TopicInfo[];
title: ResourceStr;
topicId: string;
constructor(topicInfo: TopicInfo[], title: ResourceStr, topicId: string) {
this.topicInfo = topicInfo;
this.title = title;
this.topicId = topicId;
}
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/CommonModel.ets#L86-L96 | 85f6a0479c502d385355647a369575a6c54c1ade | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/ChatbotEngine.ets | arkts | getContextVariable | 获取上下文变量 | getContextVariable(sessionId: string, name: string): any {
try {
const sessionVars = this.contextVariables.get(sessionId);
if (!sessionVars) return null;
const variable = sessionVars.get(name);
if (!variable) return null;
// 检查是否过期
if (variable.expiresAt && new Date() > new Dat... | AST#method_declaration#Left getContextVariable AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | getContextVariable(sessionId: string, name: string): any {
try {
const sessionVars = this.contextVariables.get(sessionId);
if (!sessionVars) return null;
const variable = sessionVars.get(name);
if (!variable) return null;
if (variable.expiresAt && new Date() > new Date(variabl... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L288-L308 | c00d5ac2ccfc00cb0d3e8af29a72362112d90729 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/DateUtils.ets | arkts | isUpcomingBirthday | 判断是否为即将到来的生日
@param birthDate 出生日期
@param days 提前天数
@param isLunar 是否农历生日
@returns 是否为即将到来的生日 | static isUpcomingBirthday(birthDate: string | Date, days: number = 7, isLunar: boolean = false): boolean {
const daysUntil = DateUtils.getDaysUntilBirthday(birthDate, isLunar);
return daysUntil > 0 && daysUntil <= days;
} | AST#method_declaration#Left static isUpcomingBirthday AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter... | static isUpcomingBirthday(birthDate: string | Date, days: number = 7, isLunar: boolean = false): boolean {
const daysUntil = DateUtils.getDaysUntilBirthday(birthDate, isLunar);
return daysUntil > 0 && daysUntil <= days;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L242-L245 | 3e16107cc671f932d5738e2a0f702785afec3362 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarUtils.ets | arkts | solarToLunar | 公历转农历
@param solarDate 公历日期(YYYY-MM-DD格式或Date对象)
@returns 农历日期信息 | static solarToLunar(solarDate: string | Date): LunarDate | null {
const solar = typeof solarDate === 'string' ? new Date(solarDate) : solarDate;
if (isNaN(solar.getTime())) {
return null;
}
// 计算与基础日期的天数差
let daysDiff = Math.floor((solar.getTime() - LunarUtils.BASE_SOLAR_DATE.getTime... | AST#method_declaration#Left static solarToLunar AST#parameter_list#Left ( AST#parameter#Left solarDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right... | static solarToLunar(solarDate: string | Date): LunarDate | null {
const solar = typeof solarDate === 'string' ? new Date(solarDate) : solarDate;
if (isNaN(solar.getTime())) {
return null;
}
let daysDiff = Math.floor((solar.getTime() - LunarUtils.BASE_SOLAR_DATE.getTime()) / (24 * 60... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L170-L233 | f6ccd4ecb3557fd641c1dd63754d57d328b377ca | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NavigationRouter/RouterModule/src/main/ets/model/RouterModel.ets | arkts | 创建路由信息,并放到路由栈表中 | export function buildRouterModel(routerName: string, builderName: string, param?: object) {
let router: RouterModel = new RouterModel();
router.builderName = builderName;
router.routerName = routerName;
router.param = param;
RouterModule.push(router);
} | AST#export_declaration#Left export AST#function_declaration#Left function buildRouterModel AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builderName : AST#type_anno... | export function buildRouterModel(routerName: string, builderName: string, param?: object) {
let router: RouterModel = new RouterModel();
router.builderName = builderName;
router.routerName = routerName;
router.param = param;
RouterModule.push(router);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/model/RouterModel.ets#L30-L36 | 2bb9d7da660c5644e62de598369e64e9e4e485de | gitee | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/RadixSort.ets | arkts | 基数排序实现 | export class RadixSort {
/**
* 基数排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/
public static sort(arr: number[]): number[] {
if (arr.length === 0) {
return [];
}
const result = [...arr];
const max = Math.max(...result);
let exp = 1;
// 对每一位进行计数排序
while (Math.floor(ma... | AST#export_declaration#Left export AST#class_declaration#Left class RadixSort AST#class_body#Left { /**
* 基数排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/ AST#method_declaration#Left public static sort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#arra... | export class RadixSort {
public static sort(arr: number[]): number[] {
if (arr.length === 0) {
return [];
}
const result = [...arr];
const max = Math.max(...result);
let exp = 1;
while (Math.floor(max / exp) > 0) {
RadixSort.countingSort(result, exp);
exp *= 10;
... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/RadixSort.ets#L4-L46 | 6d7192906be58d79e0d6bc2071a1b809f5f37a6a | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/components/FloatingButton.ets | arkts | getWindowInfo | 获取窗口尺寸信息 | async getWindowInfo() {
if (!this.windowClass) {
return;
}
//状态栏高度
this.statusHeight = px2vp(this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height);
//获取手机底部规避区域高度,额外避让底部tab栏
this.bottomAvoidAreaHeight =
px2vp(this.windowClass.getWindowAvoidArea(window.... | AST#method_declaration#Left async getWindowInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#u... | async getWindowInfo() {
if (!this.windowClass) {
return;
}
this.statusHeight = px2vp(this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height);
this.bottomAvoidAreaHeight =
px2vp(this.windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_IN... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/components/FloatingButton.ets#L78-L99 | 6b1d5130f9e63712a44c044465cd519e92932861 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/DateUtils.ets | arkts | getCurrentTime | 获取当前时间字符串
@param format 格式
@returns 格式化的当前时间 | static getCurrentTime(format: string = DateFormatConstants.TIME_FORMAT_HH_MM): string {
return DateUtils.formatDate(new Date(), format);
} | AST#method_declaration#Left static getCurrentTime AST#parameter_list#Left ( AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left DateFormatConstants AST#expression#Right . T... | static getCurrentTime(format: string = DateFormatConstants.TIME_FORMAT_HH_MM): string {
return DateUtils.formatDate(new Date(), format);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L118-L120 | 38cbf6201864362179da8898afb88e7439b02c57 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets | arkts | pop | 通过路由栈名routerName获取对应的NavPathStack对象,并使用该对象的pop方法实现返回上个路由 | public static pop(routerName: string): void {
RouterModule.getRouter(routerName).pop();
} | AST#method_declaration#Left public static pop AST#parameter_list#Left ( AST#parameter#Left routerName : 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 void AST#primary_... | public static pop(routerName: string): void {
RouterModule.getRouter(routerName).pop();
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets#L62-L64 | 53839c6be641f5676aa68afa0e703f3a08ae0b6b | gitee |
huang7855196/ArkTs-iLearn.git | 08590adaca7a58d5284416ba5cfc09117122af84 | commonModule/src/main/ets/components/HotQuestionView.ets | arkts | HotQuestionView | @desc:首页热门题库
@author:hxy
@time:2024/3/19 | @Component
export struct HotQuestionView {
linearColor: LinerColorType = LinerColorType.GREEN
title: string = ''
subTitle: string = ''
build() {
Row() {
Column() {
Text(this.title)
.fontSize(14)
.padding({ top: 8, bottom: 8 })
.fontColor(Color.White)
Text... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HotQuestionView AST#component_body#Left { AST#property_declaration#Left linearColor : AST#type_annotation#Left AST#primary_type#Left LinerColorType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Lef... | @Component
export struct HotQuestionView {
linearColor: LinerColorType = LinerColorType.GREEN
title: string = ''
subTitle: string = ''
build() {
Row() {
Column() {
Text(this.title)
.fontSize(14)
.padding({ top: 8, bottom: 8 })
.fontColor(Color.White)
Text... | https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/commonModule/src/main/ets/components/HotQuestionView.ets#L6-L40 | 80dc6243b523c146b1611bded3f1d25eab975a56 | github |
ccccjiemo/egl.git | d18849c3da975ccf9373fd09874aa5637ccbe6bd | Index.d.ets | arkts | releaseTexImage | eglReleaseTexImage | releaseTexImage(dpy: EGLDisplay, buffer: EGLConfigAttribute | number): boolean; | AST#method_declaration#Left releaseTexImage AST#parameter_list#Left ( AST#parameter#Left dpy : AST#type_annotation#Left AST#primary_type#Left EGLDisplay AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left E... | releaseTexImage(dpy: EGLDisplay, buffer: EGLConfigAttribute | number): boolean; | https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L72-L72 | 658db8b269bb2a7aaff72dd0757b70c8f56ba616 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppDelay/entry/src/main/ets/pages/CustomContent.ets | arkts | CustomContent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct CustomContent {
@Prop color: Color;
build() {
Column()
.width('100%')
.height('100%')
.backgroundColor(this.color)
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomContent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right color : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotati... | @Component
export struct CustomContent {
@Prop color: Color;
build() {
Column()
.width('100%')
.height('100%')
.backgroundColor(this.color)
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/CustomContent.ets#L16-L26 | b0c7e5a0e70809ea588645b89a333f00dd8f21e6 | gitee |
openharmony/applications_systemui | 413f701448a7923a18a761e3cb54f0b871cfef40 | features/airplanecomponent/src/main/ets/default/pages/airplaneComponent.ets | arkts | mClickEvent | when flyModelStatus == true, so airplane is opening,
use variable mWifiOriginalStatus to record WLAN current status
use system interface to WLAN current status: WifiInfo.isWifiActive()
when flyModelStatus == false ,so airplane is closed
get variable mWifiOriginalStatus
if variable mWifiOriginalStatus == true, set WLAN ... | mClickEvent() {
this.flyModelStatus =!this.flyModelStatus;
Log.showDebug(TAG, `flyModelStatus:${this.flyModelStatus}`);
if (this.flyModelStatus == true) {
this.mWifiOriginalStatus = wifi.isWifiActive();
Log.showInfo(TAG, `airplane status is opening, WLAN Original Status :${this.mWifiOriginalStat... | AST#method_declaration#Left mClickEvent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flyModelStatus AST#member_expression#R... | mClickEvent() {
this.flyModelStatus =!this.flyModelStatus;
Log.showDebug(TAG, `flyModelStatus:${this.flyModelStatus}`);
if (this.flyModelStatus == true) {
this.mWifiOriginalStatus = wifi.isWifiActive();
Log.showInfo(TAG, `airplane status is opening, WLAN Original Status :${this.mWifiOriginalStat... | https://github.com/openharmony/applications_systemui/blob/413f701448a7923a18a761e3cb54f0b871cfef40/features/airplanecomponent/src/main/ets/default/pages/airplaneComponent.ets#L42-L58 | f797574bf6a538c70efaaf1d09116f5a0134700c | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets | arkts | reverseData | 翻转数组 | public reverseData(): void {
this.originDataArray.reverse();
this.notifyDataReload();
} | AST#method_declaration#Left public reverseData 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#expre... | public reverseData(): void {
this.originDataArray.reverse();
this.notifyDataReload();
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L89-L92 | da8ce66a36c994a45c20b47a5989655b7dc5c3d5 | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | filter | 添加视频滤镜 | public filter(filterExpr: string): FFmpegCommandBuilder {
this.filters.push(filterExpr);
return this;
} | AST#method_declaration#Left public filter AST#parameter_list#Left ( AST#parameter#Left filterExpr : 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 ... | public filter(filterExpr: string): FFmpegCommandBuilder {
this.filters.push(filterExpr);
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L75-L78 | d72e82fdc62fef80c45c23b0260128b223fc2d2f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/listitemoverflow/Index.ets | arkts | AboutMeComponent | 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 { AboutMeComponent } from './src/main/ets/pages/AboutMe'; | AST#export_declaration#Left export { AboutMeComponent } from './src/main/ets/pages/AboutMe' ; AST#export_declaration#Right | export { AboutMeComponent } from './src/main/ets/pages/AboutMe'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listitemoverflow/Index.ets#L15-L15 | d78c0b856a9868d53e19986953d12febc099d0bd | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | getZoomRatioRange | 获取可变焦距范围 | getZoomRatioRange(): Array<number> {
let zoomRatioRange: Array<number> = [];
if (this.session !== undefined) {
zoomRatioRange = this.session.getZoomRatioRange();
}
return zoomRatioRange;
} | AST#method_declaration#Left getZoomRatioRange 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_argu... | getZoomRatioRange(): Array<number> {
let zoomRatioRange: Array<number> = [];
if (this.session !== undefined) {
zoomRatioRange = this.session.getZoomRatioRange();
}
return zoomRatioRange;
} | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L265-L271 | 8d5ec531c35e306ab63573f0a395f93284b7cc9a | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets | arkts | onMove | 需要覆写的平移事件
@param event | public onMove(event: TouchEvent) {} | AST#method_declaration#Left public onMove AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#... | public onMove(event: TouchEvent) {} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets#L174-L174 | deb1d2ce0396a39fa8ae2333e420c53ded3a3781 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/GreetingsPage.ets | arkts | buildGreetingItem | 构建祝福语项 | @Builder
buildGreetingItem(greeting: Greeting) {
Row({ space: 16 }) {
// 选择框(选择模式下)
if (this.isSelectionMode) {
Checkbox()
.select(this.selectedGreetings.has(greeting.id))
.onChange((value: boolean) => {
this.toggleGreetingSelection(greeting.id);
})
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingItem AST#parameter_list#Left ( AST#parameter#Left greeting : AST#type_annotation#Left AST#primary_type#Left Greeting AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_funct... | @Builder
buildGreetingItem(greeting: Greeting) {
Row({ space: 16 }) {
if (this.isSelectionMode) {
Checkbox()
.select(this.selectedGreetings.has(greeting.id))
.onChange((value: boolean) => {
this.toggleGreetingSelection(greeting.id);
})
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L369-L486 | 1074d095d727d6ab1f0d791fc4b107a6ac4dbae8 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_axios/src/main/ets/ui/AxiosLoadingUtil.ets | arkts | closeLoading | 关闭窗口
@returns | static async closeLoading(): Promise<void> {
if (WinLoadingUtil.cacheWindow) {
WinLoadingUtil.showTimes -= 1;
if (WinLoadingUtil.showTimes == 0) {
await WinLoadingUtil.cacheWindow.destroyWindow();
}
}
} | AST#method_declaration#Left static async closeLoading AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#t... | static async closeLoading(): Promise<void> {
if (WinLoadingUtil.cacheWindow) {
WinLoadingUtil.showTimes -= 1;
if (WinLoadingUtil.showTimes == 0) {
await WinLoadingUtil.cacheWindow.destroyWindow();
}
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/ui/AxiosLoadingUtil.ets#L100-L107 | 5f539efc91f8bec5edad05b8e0fb376595172676 | gitee |
HunZiLei/ArtTs_PokeAccountBook.git | 3d91db931f5dd6cea3c6cd414fad7c28942a58ac | entry/src/main/ets/bean/ConstrantsInterface.ets | arkts | 数据库相关 | export interface AccountTable{
tableName: string;
sqlCreate: string; //记录sql语句
columns: string[]; //查询到的结果
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AccountTable AST#object_type#Left { AST#type_member#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left sqlCreate : AST#type_annota... | export interface AccountTable{
tableName: string;
sqlCreate: string;
columns: string[];
} | https://github.com/HunZiLei/ArtTs_PokeAccountBook.git/blob/3d91db931f5dd6cea3c6cd414fad7c28942a58ac/entry/src/main/ets/bean/ConstrantsInterface.ets#L2-L6 | 3021c95341fdc2b059f2420bd1be51e5e78b94e7 | github | |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/MessageUtils.ets | arkts | countEmpty | 统计空消息数量
@param messages 消息数组
@returns 空消息的数量
使用示例:
```typescript
const people = [person1, emptyPerson, person3]
const emptyCount = MessageUtils.countEmpty(people)
// emptyCount: 1
``` | static countEmpty<T extends Message>(messages: T[]): number {
return messages.filter(m => m.isEmpty()).length
} | AST#method_declaration#Left static countEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : ... | static countEmpty<T extends Message>(messages: T[]): number {
return messages.filter(m => m.isEmpty()).length
} | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L347-L349 | 5a6b55929701c920c72d7e3ff9c107cad91ef709 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/VideoViewModel.ets | arkts | Init video data. | export function initializeOnStartup(): Array<VideoItem> {
let videoDataArray: Array<VideoItem> = []
VIDEO_DATA.forEach(item => {
videoDataArray.push(item);
})
return videoDataArray;
} | AST#export_declaration#Left export AST#function_declaration#Left function initializeOnStartup 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 VideoItem AST#primary_t... | export function initializeOnStartup(): Array<VideoItem> {
let videoDataArray: Array<VideoItem> = []
VIDEO_DATA.forEach(item => {
videoDataArray.push(item);
})
return videoDataArray;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/VideoViewModel.ets#L22-L28 | ad86b724f108637418917e5b049917f5e7d59c19 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.