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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/attribute/ColumnAttribute.ets | arkts | 获取纵向两端分布 + 水平末尾的 Column 对齐修饰器
@returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器
@example
Column() { Text("A"); Text("B"); }.attributeModifier(columnSpaceBetweenEnd()); | export function columnSpaceBetweenEnd(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(HorizontalAlign.End);
}
};
} | AST#export_declaration#Left export AST#function_declaration#Left function columnSpaceBetweenEnd AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAtt... | export function columnSpaceBetweenEnd(): AttributeModifier<ColumnAttribute> {
return {
applyNormalAttribute: (instance: ColumnAttribute): void => {
instance.justifyContent(FlexAlign.SpaceBetween);
instance.alignItems(HorizontalAlign.End);
}
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L147-L154 | 14aebd75bef20e68c8c2ee4c5cad00cd00f25b8f | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets | arkts | onAdvertisingStateChange | 1 订阅广播状态 | public onAdvertisingStateChange() {
try {
ble.on('advertisingStateChange', (data: ble.AdvertisingStateChangeInfo) => {
console.info(TAG, 'bluetooth advertising state = ' + JSON.stringify(data));
AppStorage.setOrCreate('advertiserState', data.state);
});
} catch (err) {
console.... | AST#method_declaration#Left public onAdvertisingStateChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | public onAdvertisingStateChange() {
try {
ble.on('advertisingStateChange', (data: ble.AdvertisingStateChangeInfo) => {
console.info(TAG, 'bluetooth advertising state = ' + JSON.stringify(data));
AppStorage.setOrCreate('advertiserState', data.state);
});
} catch (err) {
console.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/BluetoothAdvertising.ets#L54-L63 | 3b9607f17931b420486cae1c265a5f600aabcbeb | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 上传图片(Base64格式)
@param data 包含Base64图片数据和文件名的对象
@returns 上传后的图片URL和文件名 | export interface UploadImageParams {
base64Image: string;
fileName: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UploadImageParams AST#object_type#Left { AST#type_member#Left base64Image : 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 fileName : AST#type_... | export interface UploadImageParams {
base64Image: string;
fileName: string;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L600-L603 | 235648455e19506e6e743537c04e8cc7d92619ca | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets | arkts | 获取NodeController | export function getNWeb(url: string): NWebNodeController | null {
if (currentNode.url != url || !currentNode.lastNetAvailable) {
loadUrl(url);
}
currentNode.lastNetAvailable = connection.hasDefaultNetSync();
return currentNode.nWebController;
} | AST#export_declaration#Left export AST#function_declaration#Left function getNWeb 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#type_annotation#Left AST#union_... | export function getNWeb(url: string): NWebNodeController | null {
if (currentNode.url != url || !currentNode.lastNetAvailable) {
loadUrl(url);
}
currentNode.lastNetAvailable = connection.hasDefaultNetSync();
return currentNode.nWebController;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets#L146-L152 | fcaa9667a9bc01ca4cbe6a6366903566c3826f33 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/model/IChatUI.ets | arkts | 聊天信息组件接口 | export interface IChatUI {
/**
* 用户输入信息
*/
userInput: string;
/**
* 发送消息到UI函数
* @param msg 消息内容
* @param clearInput 指示是否清空输入框
*/
postMessage(msg: ChatMessage, clearInput?: boolean) : void;
/**
* 消息等待动画函数
*
* @param isTyping
*/
setTyping(isTyping: boolean) : void;
/**
... | AST#export_declaration#Left export AST#interface_declaration#Left interface IChatUI AST#object_type#Left { /**
* 用户输入信息
*/ AST#type_member#Left userInput : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 发送消息到UI函数
* @param ... | export interface IChatUI {
userInput: string;
postMessage(msg: ChatMessage, clearInput?: boolean) : void;
setTyping(isTyping: boolean) : void;
submitUserInput(userIputText: string) :void;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/IChatUI.ets#L6-L34 | 4ffdb7a65aea69dc1db8b420039f00643d508471 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/permission/PermissionUtils.ets | arkts | requestCameraPermission | 申请相机权限
用法示例:PermissionUtils.requestCameraPermission() { granted => ... }
@param callback 权限申请结果回调 | public async requestCameraPermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = ["ohos.permission.CAMERA"];
await this.handlePermissionResult('相机权限', callback, permissions);
} | AST#method_declaration#Left public async requestCameraPermission AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left granted : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotatio... | public async requestCameraPermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = ["ohos.permission.CAMERA"];
await this.handlePermissionResult('相机权限', callback, permissions);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L185-L188 | d4ae3aec7b9c28f6a24af2ed0155895717ed5e5d | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets | arkts | Controls the style types of GridObjectSortComponent.
@enum { string }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
Controls the style types of GridObjectSortComponent.
@enum { string }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12
@noninterop | export declare enum GridObjectSortComponentType {
/**
* The GridObjectSortComponent image text type.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* The GridObjectSortComponent image text type.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum GridObjectSortComponentType AST#enum_body#Left { /**
* The GridObjectSortComponent image text type.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/ /**
* The GridObjectS... | export declare enum GridObjectSortComponentType {
IMAGE_TEXT = "image_text",
TEXT = "text"
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets#L37-L67 | 7f04b8ac7ae5b8a3eb2c146bdfc52b4add66d41a | gitee | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/BreakpointTransmission/entry/src/main/ets/pages/Index.ets | arkts | getSaveFilePath | 选择文件保存位置 | async getSaveFilePath(): Promise<string> {
let selectedSaveFilePath: string = ""
let documentSaveOptions = new picker.DocumentSaveOptions();
let documentPicker = new picker.DocumentViewPicker(getContext(this));
await documentPicker.save(documentSaveOptions).then((result: Array<string>) => {
select... | AST#method_declaration#Left async getSaveFilePath AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#typ... | async getSaveFilePath(): Promise<string> {
let selectedSaveFilePath: string = ""
let documentSaveOptions = new picker.DocumentSaveOptions();
let documentPicker = new picker.DocumentViewPicker(getContext(this));
await documentPicker.save(documentSaveOptions).then((result: Array<string>) => {
select... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/Index.ets#L239-L247 | 6cb93c455717e7d175fc9514e785f63fe855d4de | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/WindowSafeAreaState.ets | arkts | WindowSafeAreaState | 全局窗口安全区状态 | @ObservedV2
export class WindowSafeAreaState {
/**
* 顶部安全区高度(vp)
*/
@Trace
topInset: number = 0;
/**
* 左侧安全区宽度(vp)
*/
@Trace
leftInset: number = 0;
/**
* 底部安全区高度(vp)
*/
@Trace
bottomInset: number = 0;
/**
* 右侧安全区宽度(vp)
*/
@Trace
rightInset: number = 0;
/**
* 更新安全区数据... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class WindowSafeAreaState AST#class_body#Left { /**
* 顶部安全区高度(vp)
*/ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right topInset : AST#type_annotation#Left AST#primary_type#Left number AST#pr... | @ObservedV2
export class WindowSafeAreaState {
@Trace
topInset: number = 0;
@Trace
leftInset: number = 0;
@Trace
bottomInset: number = 0;
@Trace
rightInset: number = 0;
updateSafeArea(topInset: number, leftInset: number, bottomInset: number, rightInset: number): void {
this.topInse... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/WindowSafeAreaState.ets#L17-L67 | 688b61628c18977eb2392a49111a953762f9f062 | github |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/model/KeyboardController.ets | arkts | moveCursor | 移动光标 | public moveCursor(direction: inputMethodEngine.Direction): void {
if (this.mTextInputClient !== undefined) {
this.addLog(`moveCursor direction = $ {direction}`);
this.mTextInputClient.moveCursor(direction);
} else {
this.addLog('moveCursor this.mTextInputClient is undefined');
}
} | AST#method_declaration#Left public moveCursor AST#parameter_list#Left ( AST#parameter#Left direction : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left inputMethodEngine . Direction AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#R... | public moveCursor(direction: inputMethodEngine.Direction): void {
if (this.mTextInputClient !== undefined) {
this.addLog(`moveCursor direction = $ {direction}`);
this.mTextInputClient.moveCursor(direction);
} else {
this.addLog('moveCursor this.mTextInputClient is undefined');
}
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/KeyboardController.ets#L188-L195 | 60071866ca22e82a025d78b0643581f501120f6c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/plug/ArkWebPage.ets | arkts | onBackPress | 可选,JS交互 | onBackPress(): boolean {
if (this.controller?.accessBackward()) {
this.controller?.backward();
return true;
}
return false;
} | AST#method_declaration#Left onBackPress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST... | onBackPress(): boolean {
if (this.controller?.accessBackward()) {
this.controller?.backward();
return true;
}
return false;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/plug/ArkWebPage.ets#L22-L28 | 2567b7fb36cfd50be3a7d73cdc505b92f2278ee4 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/TitleView.ets | arkts | TitleView | 标题栏子组件 | @Component
export struct TitleView {
@ObjectLink title: Title;
private clickListener: (() => void) = () => {
};
build() {
Text(this.title.name)
.fontColor(this.title.isSelected ? Color.Blue : Color.Black)
.onClick(() => {
if (this.clickListener) {
this.clickListener();
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left Title AST#primary_type#Right AST#type_annota... | @Component
export struct TitleView {
@ObjectLink title: Title;
private clickListener: (() => void) = () => {
};
build() {
Text(this.title.name)
.fontColor(this.title.isSelected ? Color.Blue : Color.Black)
.onClick(() => {
if (this.clickListener) {
this.clickListener();
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/TitleView.ets#L19-L34 | 5bdda4289e049de9e0e17ce86761f21b341986bd | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | reset | 重置构建器 | public reset(): FFmpegCommandBuilder {
this.inputFiles = [];
this.outputPath = '';
this.useHwDecode = false;
this.useHwEncode = false;
this.filters = [];
this.vCodec = '';
this.aCodec = '';
this.vBitrate = '';
this.aBitrate = '';
this.presetValue = '';
this.crfValue = -1;
... | AST#method_declaration#Left public reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expressio... | public reset(): FFmpegCommandBuilder {
this.inputFiles = [];
this.outputPath = '';
this.useHwDecode = false;
this.useHwEncode = false;
this.filters = [];
this.vCodec = '';
this.aCodec = '';
this.vBitrate = '';
this.aBitrate = '';
this.presetValue = '';
this.crfValue = -1;
... | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L243-L260 | 355080056a9d30649e4772f937417bd8b4d4d9f7 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | likePost | 点赞帖子 | async likePost(postId: string): Promise<boolean> {
try {
if (!this.currentUser) return false;
// TODO: 发送点赞请求到服务器
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Post liked: ${postId}`);
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TA... | AST#method_declaration#Left async likePost AST#parameter_list#Left ( AST#parameter#Left postId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Pr... | async likePost(postId: string): Promise<boolean> {
try {
if (!this.currentUser) return false;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Post liked: ${postId}`);
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Fa... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L351-L363 | 3ce722efebe85f2ce85d950b9302262fffc891b7 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets | arkts | login | Check whether the decrypted password is consistent with the password entered by the user.
If yes, the login is successful. | login() {
let user = this.userList[0];
if (this.decryptPassword === this.password) {
// The login success page is displayed.
router.replaceUrl({
url: CommonConstants.ROUTER_WELCOME_URL,
params: { 'username': user.username }
}).catch((err: Error) => {
Logger.error(`Faile... | AST#method_declaration#Left login AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left user = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ... | login() {
let user = this.userList[0];
if (this.decryptPassword === this.password) {
router.replaceUrl({
url: CommonConstants.ROUTER_WELCOME_URL,
params: { 'username': user.username }
}).catch((err: Error) => {
Logger.error(`Failed router to welcome page, ${err}`);
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets#L198-L211 | 9335bb60a7cdccae53fb0fb4c1b44b50290de060 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets | arkts | buildCardInfoList | buildCardInfoList
@param dialog | buildCardInfoList(dialog: CustomDialogController) {
let menuInfoList = new Array<MenuInfo>();
const uninstallMenu = new MenuInfo();
uninstallMenu.menuImgSrc = $r('app.media.ic_public_delete');
uninstallMenu.menuText = $r('app.string.remove');
uninstallMenu.onMenuClick = () => {
Logger.info(TAG... | AST#method_declaration#Left buildCardInfoList AST#parameter_list#Left ( AST#parameter#Left dialog : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#vari... | buildCardInfoList(dialog: CustomDialogController) {
let menuInfoList = new Array<MenuInfo>();
const uninstallMenu = new MenuInfo();
uninstallMenu.menuImgSrc = $r('app.media.ic_public_delete');
uninstallMenu.menuText = $r('app.string.remove');
uninstallMenu.onMenuClick = () => {
Logger.info(TAG... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L156-L169 | 02d7dc53385ff0cb84a272108987750ec13b0ada | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/dialogs/managers/woofHistory.ets | arkts | select_unselect | Selects or unselects myself, usually called when onClick. | select_unselect() {
if (this.selected[this.index]) {
this.selected_item_quantity -= 1;
} else {
this.selected_item_quantity += 1;
}
this.selected[this.index] = !this.selected[this.index];
} | AST#method_declaration#Left select_unselect AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressio... | select_unselect() {
if (this.selected[this.index]) {
this.selected_item_quantity -= 1;
} else {
this.selected_item_quantity += 1;
}
this.selected[this.index] = !this.selected[this.index];
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/dialogs/managers/woofHistory.ets#L569-L576 | 120cfad7eb3b025eff6a0f70593903022e55a081 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | videoCodec | 设置视频编码器 | public videoCodec(codec: string): FFmpegCommandBuilder {
this.vCodec = codec;
return this;
} | AST#method_declaration#Left public videoCodec AST#parameter_list#Left ( AST#parameter#Left codec : 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 A... | public videoCodec(codec: string): FFmpegCommandBuilder {
this.vCodec = codec;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L81-L84 | 3a5cd82f6a8b4e9205aa33c9dd5de0b090a25299 | github |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/LoginPage.ets | arkts | onLoginTimeout | 登录超时后要执行的逻辑。 | onLoginTimeout() {
// * 清除登录状态等
this.isLogining = false;
// 确认Action
let confrimAction: Callback<void> = () => {
// 重试
this.doLogin();
};
// 退出Action
let cancelAction: Callback<void> = () => {
// 取消登陆中的状态
this.isLogining = false;
};
// 显示超时提示窗
ToolKits.... | AST#method_declaration#Left onLoginTimeout AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // * 清除登录状态等 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoginin... | onLoginTimeout() {
this.isLogining = false;
let confrimAction: Callback<void> = () => {
this.doLogin();
};
let cancelAction: Callback<void> = () => {
this.isLogining = false;
};
ToolKits.showAlertDialog('登录超时,可能是网络故障或服务器无法连接,是否重试?', '重试!', undefin... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/LoginPage.ets#L156-L174 | 14dd7a2b996600de6ceec1a69d650bd7125c6a1c | github |
Autumnker/ArkTS_FreeKnowledgeChat.git | cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7 | entry/src/main/ets/pages/startPage/RegisterPage.ets | arkts | RegisterPage | 注册页面 | @Entry
@Component
export struct RegisterPage{
@State @Watch('onInputChange') inputnickname:string='' // Watch侦听器:侦听器件的变化
@State @Watch('onInputChange') inputpassword:string=''
@State @Watch('onInputChange') repeatinputpassword:string=''
@State btnisdisable:boolean=true
// 改变按钮可点击性
onInputChange(){
th... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct RegisterPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onIn... | @Entry
@Component
export struct RegisterPage{
@State @Watch('onInputChange') inputnickname:string=''
@State @Watch('onInputChange') inputpassword:string=''
@State @Watch('onInputChange') repeatinputpassword:string=''
@State btnisdisable:boolean=true
onInputChange(){
this.btnisdisable=!(this.inputni... | https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/pages/startPage/RegisterPage.ets#L7-L19 | dc4741c0612eb5501c88d24b1e973536b77e13bf | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/OpenAI.ets | arkts | AI的一个回答 | export class Choice {
public finish_reason: string = ""
public message: Message = new Message("", "")
constructor | AST#export_declaration#Left export AST#ERROR#Left class Choice { AST#property_declaration#Left public finish_reason : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#property_declaration#Right public message : AST#... | export class Choice {
public finish_reason: string = ""
public message: Message = new Message("", "")
constructor | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/OpenAI.ets#L25-L29 | f2d304ebc1a32eb69c3ca468f6afb120f669a7dc | gitee | |
openharmony/xts_tools | 784a2e99d894e6bc2aba8c38f6bb68032442b1c8 | sample/AppSampleD/entry/src/main/ets/appsampled/data/Tool.ets | arkts | Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 l... | export default class Tool{
private toolName: string;
private toolIcon: Resource;
constructor(toolName: string, toolIcon: Resource) {
this.toolName = toolName;
this.toolIcon = toolIcon;
}
public getToolName(): string{
return this.toolName;
}
public setToolName(toolName: string){
this.tool... | AST#export_declaration#Left export default AST#class_declaration#Left class Tool AST#class_body#Left { AST#property_declaration#Left private toolName : 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 pr... | export default class Tool{
private toolName: string;
private toolIcon: Resource;
constructor(toolName: string, toolIcon: Resource) {
this.toolName = toolName;
this.toolIcon = toolIcon;
}
public getToolName(): string{
return this.toolName;
}
public setToolName(toolName: string){
this.tool... | https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/appsampled/data/Tool.ets#L15-L36 | 340f8cee1d9054514f9786e52cba1456270ed92b | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets | arkts | 查找数组中出现次数最多的像素
@param allPixels 像素数组
@returns 出现次数最多的像素 | export function findMaxPixel(allPixels: number[]): number {
// 遍历数组,将像素放到一个Map中,key是像素值,value是该像素值出现的次数
const map: Map<number, number> = new Map();
allPixels.forEach((pixel: number) => {
if (map.has(pixel)) {
map.set(pixel, map.get(pixel)! + 1);
} else {
map.set(pixel, 1);
}
})
// 查找出现... | AST#export_declaration#Left export AST#function_declaration#Left function findMaxPixel AST#parameter_list#Left ( AST#parameter#Left allPixels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#pa... | export function findMaxPixel(allPixels: number[]): number {
const map: Map<number, number> = new Map();
allPixels.forEach((pixel: number) => {
if (map.has(pixel)) {
map.set(pixel, map.get(pixel)! + 1);
} else {
map.set(pixel, 1);
}
})
let maxPixel: number = 0;
let maxTimes: numbe... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets#L48-L68 | 632c805baf6106a111b8e4542386bf2554cc338d | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets | arkts | showRefundModal | 显示退款原因选择弹窗
@returns {void} 无返回值 | showRefundModal(): void {
this.refundModalVisible = true;
this.loadRefundReasons();
} | AST#method_declaration#Left showRefundModal 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#me... | showRefundModal(): void {
this.refundModalVisible = true;
this.loadRefundReasons();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L88-L91 | 8463bad4174d711496edb2c5663339b254ca3011 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/update/UpdateManager.ets | arkts | checkUpdate | 检查更新 | async checkUpdate(checkUrl?: string): Promise<UpdateInfo | null> {
try {
Logger.info('UpdateManager', 'Checking for updates...');
const currentVersion = await this.getCurrentVersion();
const lastCheckTime = await StorageManager.getNumber(this.LAST_CHECK_KEY, 0);
const now = Date.now()... | AST#method_declaration#Left async checkUpdate AST#parameter_list#Left ( AST#parameter#Left checkUrl ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | async checkUpdate(checkUrl?: string): Promise<UpdateInfo | null> {
try {
Logger.info('UpdateManager', 'Checking for updates...');
const currentVersion = await this.getCurrentVersion();
const lastCheckTime = await StorageManager.getNumber(this.LAST_CHECK_KEY, 0);
const now = Date.now()... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/update/UpdateManager.ets#L77-L124 | c8d7f45fc2bc5e404b71f1636eb41a8f57d7396b | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets | arkts | deleteTransactionsByResource | 删除相同类型的所有交易记录 | public async deleteTransactionsByResource(resource: number) {
const condition: TablePredicateParams = {
field: TransactionTableFields.RESOURCE,
value: resource,
operator: DBOperator.EQUAL,
};
try {
const res = await this.delete(
AccountingDBConstants.TRANSACTION_TABLE_NAME,
... | AST#method_declaration#Left public async deleteTransactionsByResource AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Lef... | public async deleteTransactionsByResource(resource: number) {
const condition: TablePredicateParams = {
field: TransactionTableFields.RESOURCE,
value: resource,
operator: DBOperator.EQUAL,
};
try {
const res = await this.delete(
AccountingDBConstants.TRANSACTION_TABLE_NAME,
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L142-L164 | c9e4a0e29d6366b5a90a943f590febe842ca8fd7 | github |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/common/helper/DialogHelper.ets | arkts | showBindSheet | 显示自定义半模态
@param wrappedBuilder 自定义半模态中显示的组件内容
@param options
@returns | static showBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T) {
DialogHelper.initBindSheetDefault(options);
if(options.uiContext){
const componentContent = new ComponentContent(options.uiContext, wrappedBuilder, options);
options.uiContext.openBindSheet(componentC... | AST#method_declaration#Left static showBindSheet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left BaseSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left... | static showBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T) {
DialogHelper.initBindSheetDefault(options);
if(options.uiContext){
const componentContent = new ComponentContent(options.uiContext, wrappedBuilder, options);
options.uiContext.openBindSheet(componentC... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/helper/DialogHelper.ets#L36-L42 | b944f08c1e9f6a6bbef65a6d7034b1284ec8bd39 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/BarData.ets | arkts | Data object that represents all data for the BarChart. | export default class BarData extends BarLineScatterCandleBubbleData<IBarDataSet> {
/**
* the width of the bars on the x-axis, in values (not pixels)
*/
private mBarWidth: number = 0.85;
/**
* 顶部圆角半径
*/
private topRadius: number = 0;
constructor(dataSets ?: JArrayList<IBarDataSet>) {
super(da... | AST#export_declaration#Left export default AST#class_declaration#Left class BarData extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BarLineScatterCandleBubbleData AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left IBarDataSet AST#primary_type#Right AST#type_annotation#... | export default class BarData extends BarLineScatterCandleBubbleData<IBarDataSet> {
private mBarWidth: number = 0.85;
private topRadius: number = 0;
constructor(dataSets ?: JArrayList<IBarDataSet>) {
super(dataSets as JArrayList<IBarDataSet>);
}
public setBarWidth(mBarWidth: number): void {
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BarData.ets#L25-L153 | 3ea47e2f4493a498c10a900405c0f728ae5dba53 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/JsonParser.ets | arkts | convertObjectToContactData | 将JSON对象转换为联系人导入数据 | private static convertObjectToContactData(obj: Record<string, string | number | boolean | Record<string, string | number | boolean> | Array<string | number | boolean>>, index: number): ContactImportData | null {
if (!obj || typeof obj !== 'object') {
throw new Error('数据项必须是对象');
}
// 检查必需字段
const... | AST#method_declaration#Left private static convertObjectToContactData AST#parameter_list#Left ( AST#parameter#Left obj : 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#... | private static convertObjectToContactData(obj: Record<string, string | number | boolean | Record<string, string | number | boolean> | Array<string | number | boolean>>, index: number): ContactImportData | null {
if (!obj || typeof obj !== 'object') {
throw new Error('数据项必须是对象');
}
const nameValu... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/JsonParser.ets#L132-L142 | 36faa53f2771b918a354e045db93b768329bb886 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | Ability创建时的回调
@param want 启动参数
@param launchParam 启动参数 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onCreate');
// 初始化应用服务
this.initializeServices();
} | AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil... | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onCreate');
this.initializeServices();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L23-L28 | 44089b7c46c5d96a3728009a81f061d85b0534a3 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets | arkts | 磁盘管理器 | export class DiskCacheManager {
private cache: DiskCacheType;
/**
* 创建磁盘缓存
*
* @param diskCachePath 磁盘缓存路径
* @param diskCacheCapacity 磁盘缓存大小
*/
constructor(diskCachePath: string, diskCacheCapacity: number) {
this.cache = new DiskLruCache(diskCachePath, diskCacheCapacity);
}
/**
* 从磁盘中取... | AST#export_declaration#Left export AST#class_declaration#Left class DiskCacheManager AST#class_body#Left { AST#property_declaration#Left private cache : AST#type_annotation#Left AST#primary_type#Left DiskCacheType AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 创建磁盘缓存
*
... | export class DiskCacheManager {
private cache: DiskCacheType;
constructor(diskCachePath: string, diskCacheCapacity: number) {
this.cache = new DiskLruCache(diskCachePath, diskCacheCapacity);
}
fetchFromDisk(key: string): null | ResponseDataType {
let res = this.cache.get(key);
if (!res) {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets#L23-L58 | 27ca7001a6da9917bd185c505822415c3738e8b5 | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/utils/FilePickerUtil.ets | arkts | 拉起图库选择图片/视频,返回图片url值,该值为只读 | export function mediaPicker(type: number, pickerNum: number, callback: Function) {
// 创建图片-音频类型文件选择选项实例
const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
/**
* 选择媒体文件类型和选择媒体文件的最大数目
*/
// 过滤选择媒体文件类型
if (type === 0) {
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIM... | AST#export_declaration#Left export AST#function_declaration#Left function mediaPicker AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pickerNum : AST#type_annotation#Left A... | export function mediaPicker(type: number, pickerNum: number, callback: Function) {
const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
if (type === 0) {
photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
} else if (type === 1) {
photoSelectOptions.M... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/FilePickerUtil.ets#L10-L43 | 52a5da680e9a85ed93837e06ed1bae1a94818a11 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | BptaUseResources/entry/src/main/ets/pages/Sensor.ets | arkts | onForeground | ... | onForeground(): void {
try {
//In the foreground, listen to the required type of sensor based on the service requirements
sensor.on(sensor.SensorId.ACCELEROMETER, (data: sensor.AccelerometerResponse) => {
console.info("Succeeded in obtaining data.x:" + data.x + "y:" + data.y + "z:" + data.z);
... | AST#method_declaration#Left onForeground 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#try_statement#Left try AST#block_statement#Left { //In the foreground, li... | onForeground(): void {
try {
sensor.on(sensor.SensorId.ACCELEROMETER, (data: sensor.AccelerometerResponse) => {
console.info("Succeeded in obtaining data.x:" + data.x + "y:" + data.y + "z:" + data.z);
}, {
interval: 100000000
});
} catch (error) {
let err = error a... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/Sensor.ets#L13-L25 | 5514eceb5e8948af06879ca13984a7ee7f48e6cd | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/SettingsPage.ets | arkts | confirmEnableNotification | 确认启用通知 | confirmEnableNotification(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('允许', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'启用通知',
'开启通知后,应用将会在后台推送播客更新、下载完成等消息。\n\n是否允许启用通知功能?',
buttons
)).then((index: number) => {... | AST#method_declaration#Left confirmEnableNotification 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 const AST#variable_declarator#Left... | confirmEnableNotification(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('允许', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'启用通知',
'开启通知后,应用将会在后台推送播客更新、下载完成等消息。\n\n是否允许启用通知功能?',
buttons
)).then((index: number) => {... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SettingsPage.ets#L204-L224 | 33b95e9691fca4882daedb791dddd99c897a15fb | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarUtils.ets | arkts | parseLunarDate | 解析农历日期字符串
@param lunarDateString 农历日期字符串(如:2024-02-15 或 农历2024年二月十五)
@returns 解析结果 | static parseLunarDate(lunarDateString: string): LunarResult | null {
// 简单的YYYY-MM-DD格式解析
const dateMatch = lunarDateString.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
if (dateMatch) {
const result: LunarResult = {
year: parseInt(dateMatch[1], 10),
month: parseInt(dateMatch[2], 10),
... | AST#method_declaration#Left static parseLunarDate AST#parameter_list#Left ( AST#parameter#Left lunarDateString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primar... | static parseLunarDate(lunarDateString: string): LunarResult | null {
const dateMatch = lunarDateString.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
if (dateMatch) {
const result: LunarResult = {
year: parseInt(dateMatch[1], 10),
month: parseInt(dateMatch[2], 10),
day: parseInt(dateMa... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L314-L329 | 707ed7896140391ff5afbcdcd7a1decfe73aa4fc | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/widget/ColorPickerComponent.ets | arkts | hexToRgb | 将十六进制颜色字符串转换为 RGB 对象。
@param {string} hex - 十六进制颜色字符串,可以以 "#" 开头或不带 "#"。
@returns {RgbColor } - 返回一个DTRgbColor 对象,如果输入无效则返回默认黑色。 | function hexToRgb(hex: string): RgbColor {
// 使用正则表达式匹配十六进制颜色字符串
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
if (result) {
// 将匹配的十六进制值转换为十进制 RGB 值
return {
red: parseInt(result[1], 16),
green: parseInt(result[2], 16),
blue: parseInt(result[3], 16)
};
} el... | AST#function_declaration#Left function hexToRgb AST#parameter_list#Left ( AST#parameter#Left hex : 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 RgbColor AST#primary_t... | function hexToRgb(hex: string): RgbColor {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
if (result) {
return {
red: parseInt(result[1], 16),
green: parseInt(result[2], 16),
blue: parseInt(result[3], 16)
};
} else {
return {
red: 0,
gr... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/widget/ColorPickerComponent.ets#L38-L56 | ee961d6d681f0ec33ebd9c8f3641b18c464530ee | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageflip/src/main/ets/common/Constants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"),
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export const CONFIGURATION: Record<string, number> = {
'TABBAR_TEXT_CURRENTINDEX_FONTWEIGHT': 500,
'PAGEFLIPTWO': 2,
'PAGEFLIPZERO': 0,
'PAGEFLIPONE': 1,
'PAGEFLIPTHREE': 3,
'PAGEFLIPFOUR': 4,
'PAGEFLIPFIVE': 5,
'PAGEFLIPTWELVE': 12,
'PAGEFLIPTHIRTEEN': 13,
'FLIPPAGEZINDEX': 2,
'PAGEFLIPBOTTOMBLAN... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CONFIGURATION : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right... | export const CONFIGURATION: Record<string, number> = {
'TABBAR_TEXT_CURRENTINDEX_FONTWEIGHT': 500,
'PAGEFLIPTWO': 2,
'PAGEFLIPZERO': 0,
'PAGEFLIPONE': 1,
'PAGEFLIPTHREE': 3,
'PAGEFLIPFOUR': 4,
'PAGEFLIPFIVE': 5,
'PAGEFLIPTWELVE': 12,
'PAGEFLIPTHIRTEEN': 13,
'FLIPPAGEZINDEX': 2,
'PAGEFLIPBOTTOMBLAN... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/common/Constants.ets#L16-L41 | 5af2dac338137a57a9f8dd560f48b7625c302025 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceThree.ets | arkts | initCamera | Initializes the camera function
@param surfaceId - Surface ID
@param cameraDeviceIndex - Camera equipment index
@returns No return value | async initCamera(cameraDeviceIndex: number, uiContext:UIContext): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
// Get the Camera Manager instance
this.cameraManager = this.getCameraManagerFn(uiContext);
if (thi... | AST#method_declaration#Left async initCamera AST#parameter_list#Left ( AST#parameter#Left cameraDeviceIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIConte... | async initCamera(cameraDeviceIndex: number, uiContext:UIContext): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
this.cameraManager = this.getCameraManagerFn(uiContext);
if (this.cameraManager === undefined) {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceThree.ets#L98-L155 | 88b599bb1e93ca8e985b3657e4856cedd522a340 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Filter.d.ets | arkts | Filter | Declare Filter.The Filter is used in scenarios where multi-dimensional filtering is required.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare Filter.The Filter is used in scenarios where multi-dimensional filtering is required.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | @Component
export declare struct Filter {
/**
* Container in the user-defined filtering result display area.
* @type { () => void }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Container in the user-defined filtering result display area.
* @type { () => voi... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct Filter AST#component_body#Left { /**
* Container in the user-defined filtering result display area.
* @type { () => void }
* @syscap SystemCapability.ArkUI.ArkUI.F... | @Component
export declare struct Filter {
@BuilderParam container: () => void;
@Prop multiFilters: Array<FilterParams>;
@Prop additionFilters?: FilterParams;
onFilterChanged: (filterResults: Array<FilterResult>) => void;
@Prop filterType?: Filter... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Filter.d.ets#L179-L255 | 6dbd6882cc8a5a54c28f9ea5e0949ca0fb8e7518 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/social/SearchPage.ets | arkts | buildSearchTip | 构建搜索提示项 | @Builder
buildSearchTip(tip: string) {
Row({ space: 8 }) {
Image($r('app.media.ic_lightbulb'))
.width('16vp')
.height('16vp')
.fillColor($r('app.color.warning'))
Text(tip)
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
.layoutWeight(1)
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchTip AST#parameter_list#Left ( AST#parameter#Left tip : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#L... | @Builder
buildSearchTip(tip: string) {
Row({ space: 8 }) {
Image($r('app.media.ic_lightbulb'))
.width('16vp')
.height('16vp')
.fillColor($r('app.color.warning'))
Text(tip)
.fontSize(12)
.fontColor($r('app.color.text_secondary'))
.layoutWeight(1)
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/SearchPage.ets#L340-L354 | dab39f3d5283ff5c14b1b4e6781b6f29014a898f | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/components/DeleteView.ets | arkts | DeleteView | Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 l... | @Component
export struct DeleteView {
private enable: boolean = false;
build() {
Row() {
Image($r('app.media.ic_delete_plane'))
.width(24)
.aspectRatio(1)
}
.width(40)
.aspectRatio(1)
.borderRadius(20)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Cen... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DeleteView AST#component_body#Left { AST#property_declaration#Left private enable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boo... | @Component
export struct DeleteView {
private enable: boolean = false;
build() {
Row() {
Image($r('app.media.ic_delete_plane'))
.width(24)
.aspectRatio(1)
}
.width(40)
.aspectRatio(1)
.borderRadius(20)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Cen... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/components/DeleteView.ets#L16-L34 | 779f7e2d9016a0e1c4d406d5fa722de116b67d4a | gitee |
peng-boy/arkTs.git | 68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0 | products/default/src/main/ets/views/Basics.ets | arkts | BasicsBuilder | PageOne.ets | @Builder
export function BasicsBuilder(name: string, param: string) {
Basics({ name: name, value: param });
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BasicsBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param :... | @Builder
export function BasicsBuilder(name: string, param: string) {
Basics({ name: name, value: param });
} | https://github.com/peng-boy/arkTs.git/blob/68e3dbb97ccc581b04b166b34e3e4a9b98ac09b0/products/default/src/main/ets/views/Basics.ets#L2-L5 | 94b3d3f221d97273d53cd55857409ea1c1925e78 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets | arkts | i2dSM2 | C1C3C2格式的字符串转换成ASN.1格式的字符
@param primal_data C1C3C2格式的字符
@returns ASN.1格式的字符 | i2dSM2(primal_data: string): string {
let sm2_sequence = new SM2Sequence();
sm2_sequence.C1x = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C1y = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C3 ... | AST#method_declaration#Left i2dSM2 AST#parameter_list#Left ( AST#parameter#Left primal_data : 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#primary_type#Rig... | i2dSM2(primal_data: string): string {
let sm2_sequence = new SM2Sequence();
sm2_sequence.C1x = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C1y = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C3 ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L48-L69 | 23b9e88d1ec36c0fd374bbbb0577c3fe1d3e642b | gitee |
hushenghao/ArkTS-RelativeContainerExtend.git | 8df722220a15be576736c7a58a8ed30820c3a1ea | entry/src/main/ets/utils/SpaceExtend.ets | arkts | 水平垂直方向边距
@param horizontal
@param vertical
@returns | export function bothway(horizontal: Length, vertical: Length): Padding {
return { left: horizontal, right: horizontal, top: vertical, bottom: vertical }
} | AST#export_declaration#Left export AST#function_declaration#Left function bothway AST#parameter_list#Left ( AST#parameter#Left horizontal : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left vertical : AST#type_annotation#Left ... | export function bothway(horizontal: Length, vertical: Length): Padding {
return { left: horizontal, right: horizontal, top: vertical, bottom: vertical }
} | https://github.com/hushenghao/ArkTS-RelativeContainerExtend.git/blob/8df722220a15be576736c7a58a8ed30820c3a1ea/entry/src/main/ets/utils/SpaceExtend.ets#L25-L27 | c56818035a2637308dffa1638d415b2d21e6f3f0 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/mediafullscreen/Index.ets | arkts | MediaFullScreenComponent | 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 { MediaFullScreenComponent } from './src/main/ets/view/MediaFullScreen'; | AST#export_declaration#Left export { MediaFullScreenComponent } from './src/main/ets/view/MediaFullScreen' ; AST#export_declaration#Right | export { MediaFullScreenComponent } from './src/main/ets/view/MediaFullScreen'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mediafullscreen/Index.ets#L15-L15 | 2ce55bdf048e78d90b941ea1078e5fbc4a439764 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/pages/WatchVodPage.ets | arkts | imReceiveOnlineMessage | 接收上下线消息
@param im im
@param message 消息
注意: 消息中的头像和昵称需要 | imReceiveOnlineMessage(type: string, message: VHUserData) {
} | AST#method_declaration#Left imReceiveOnlineMessage AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left VHUserData AST#p... | imReceiveOnlineMessage(type: string, message: VHUserData) {
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/pages/WatchVodPage.ets#L238-L240 | d4a544adf95295133d7907b0d21b0c82fa2aafe4 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/MaterialEdit.ets | arkts | getMarkAnchorPosition | 相对于中心点的偏移量,-1/2素材宽,-1/2素材高 | getMarkAnchorPosition(): Position {
const dx: number = this.materialWidth / 2;
const dy: number = this.materialHeight / 2;
return {
x: dx,
y: dy
};
} | AST#method_declaration#Left getMarkAnchorPosition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left... | getMarkAnchorPosition(): Position {
const dx: number = this.materialWidth / 2;
const dy: number = this.materialHeight / 2;
return {
x: dx,
y: dy
};
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/pages/MaterialEdit.ets#L166-L173 | 398a68bb31112880b7efbfee58eae9183535fa55 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | 动画配置接口 | export interface AnimationConfig {
enabled: boolean;
duration: number;
curve: string;
scale: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AnimationConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left duration : AST#type_annot... | export interface AnimationConfig {
enabled: boolean;
duration: number;
curve: string;
scale: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L87-L92 | 04df06d2759858d9168c9d40a066a7a5219979f4 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/UserFile/DevelopingFileManagerApplication/entry/src/main/ets/filemanager/pages/ListeningForDeviceOnline.ets | arkts | onInit | 在组件初始化时创建 fileAccessHelperAllServer 对象 | onInit() {
this.createFileAccessHelper();
} | AST#method_declaration#Left onInit AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createFileAccessHelper AST#me... | onInit() {
this.createFileAccessHelper();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/UserFile/DevelopingFileManagerApplication/entry/src/main/ets/filemanager/pages/ListeningForDeviceOnline.ets#L80-L82 | e442201077ea8edec2b37d0390b6924503d04321 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/ScanUtil.ets | arkts | TODO 码工具类(扫码、码图生成、图片识码)
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class ScanUtil {
/**
* 调用默认界面扫码,使用Promise方式异步返回解码结果。
* @param options
* scanTypes 设置扫码类型,默认扫码ALL(全部码类型)。
* enableMultiMode 是否开启多码识别,默认false。true:多码识别、false:单码识别。
* enableAlbum 是否开启相册,默认true。true-开启相册扫码、false-关闭相册扫码。
* @returns ScanResult 扫码结果:
* scanType 码类型。
* originalValue... | AST#export_declaration#Left export AST#class_declaration#Left class ScanUtil AST#class_body#Left { /**
* 调用默认界面扫码,使用Promise方式异步返回解码结果。
* @param options
* scanTypes 设置扫码类型,默认扫码ALL(全部码类型)。
* enableMultiMode 是否开启多码识别,默认false。true:多码识别、false:单码识别。
* enableAlbum 是否开启相册,默认true。true-开启相册扫码、false-关闭相册扫码。
... | export class ScanUtil {
static startScanForResult(options?: scanBarcode.ScanOptions): Promise<scanBarcode.ScanResult> {
if (options === undefined) {
options = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: true };
}
return scanBarcode.startScanForResult(getContext(), ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/ScanUtil.ets#L27-L148 | c812143f175a20294aa86849b21de5206e023700 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | byMonthDayForYear | 获取某年某月的所有日期
@param year
@param month
@returns | static byMonthDayForYear(year: number, month: number): Day[][] {
const FIRST_DAY_OF_WEEK = TimeUtils.getWeekDay(year, month, 1);
const PREVIOUS_MONTH_DAYS = TimeUtils.getPreviousMonthLastDays(year, month, FIRST_DAY_OF_WEEK);
const CURRENT_MONTH_DAYS = TimeUtils.getCurrentMonthDays(year, month);
const CA... | AST#method_declaration#Left static byMonthDayForYear 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#prima... | static byMonthDayForYear(year: number, month: number): Day[][] {
const FIRST_DAY_OF_WEEK = TimeUtils.getWeekDay(year, month, 1);
const PREVIOUS_MONTH_DAYS = TimeUtils.getPreviousMonthLastDays(year, month, FIRST_DAY_OF_WEEK);
const CURRENT_MONTH_DAYS = TimeUtils.getCurrentMonthDays(year, month);
const CA... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets#L110-L164 | 0a9e9079931ef4361373cbdb2cb386424d8ccba3 | gitee |
huazheleyoushang/harmony_template.git | 9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | Lift cycle management of Ability. | export default class entryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
// 初始化容器
GlobalContext.getContext().setObject('abilityWant', want);
FontSizeUtil.createFontPreferences(this.context);
// 设置字体默认大小
FontSizeUtil.saveDefaultFontSize(DEFAULT_F... | AST#export_declaration#Left export default AST#class_declaration#Left class entryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#ty... | export default class entryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
GlobalContext.getContext().setObject('abilityWant', want);
FontSizeUtil.createFontPreferences(this.context);
FontSizeUtil.saveDefaultFontSize(DEFAULT_FONT_SIZE);
hil... | https://github.com/huazheleyoushang/harmony_template.git/blob/9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8/entry/src/main/ets/entryability/EntryAbility.ets#L13-L80 | 096fed156212279a1d25c85dc12e653a4cb963f4 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getAppNet | 获取App绑定的网络信息
@returns | static getAppNet(): Promise<connection.NetHandle> {
return connection.getAppNet();
} | AST#method_declaration#Left static getAppNet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_type#Righ... | static getAppNet(): Promise<connection.NetHandle> {
return connection.getAppNet();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L85-L87 | a7926531da9b456bc0e0c3425ef48db5bef299b5 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets | arkts | @file 用户足迹本地数据源实现
@author Joker.X | export class FootprintLocalDataSourceImpl implements FootprintLocalDataSource {
/**
* 迁移标记,防止重复执行 migrate
*/
private static migrated: boolean = false;
/**
* ORM 实例,用于执行数据库操作
*/
private orm = getORM();
/**
* 构造函数,初始化 ORM 并确保足迹表已迁移
* @returns {FootprintLocalDataSourceImpl} 实例
*/
construc... | AST#export_declaration#Left export AST#class_declaration#Left class FootprintLocalDataSourceImpl AST#implements_clause#Left implements FootprintLocalDataSource AST#implements_clause#Right AST#class_body#Left { /**
* 迁移标记,防止重复执行 migrate
*/ AST#property_declaration#Left private static migrated : AST#type_annotation... | export class FootprintLocalDataSourceImpl implements FootprintLocalDataSource {
private static migrated: boolean = false;
private orm = getORM();
constructor() {
this.ensureMigrated();
}
private ensureMigrated(): void {
if (!FootprintLocalDataSourceImpl.migrated) {
this.orm.migrate... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/footprint/FootprintLocalDataSourceImpl.ets#L10-L138 | 304fa2d8695ef2ac4962417dd7d76d5d87ad0978 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/NotificationTypes.ets | arkts | 通知操作 | export interface NotificationAction {
id: string;
label: string;
icon?: string;
action: () => void | Promise<void>;
style?: 'primary' | 'secondary' | 'danger';
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationAction AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left label : AST#type_annotation#... | export interface NotificationAction {
id: string;
label: string;
icon?: string;
action: () => void | Promise<void>;
style?: 'primary' | 'secondary' | 'danger';
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/NotificationTypes.ets#L65-L71 | 959f95b4bfe90b3ae911796e63495d1694bb8ff4 | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets | arkts | 椭圆曲线密钥交换实现
使用椭圆曲线密码学进行密钥交换 | export class EllipticCurveKeyExchange {
private static readonly P = 23; // 有限域的模数
private static readonly A = 1; // 椭圆曲线参数a
private static readonly B = 1; // 椭圆曲线参数b
private static readonly G: Point = { x: 5, y: 19 }; // 基点G
/**
* 计算模P下的加法逆元
* @param a 要计算逆元的数
* @returns 逆元
*/
private static ... | AST#export_declaration#Left export AST#class_declaration#Left class EllipticCurveKeyExchange AST#class_body#Left { AST#property_declaration#Left private static readonly P = AST#expression#Left 23 AST#expression#Right ; AST#property_declaration#Right // 有限域的模数 AST#property_declaration#Left private static readonly A = AS... | export class EllipticCurveKeyExchange {
private static readonly P = 23;
private static readonly A = 1;
private static readonly B = 1;
private static readonly G: Point = { x: 5, y: 19 };
private static modInverse(a: number): number {
a = ((a % EllipticCurveKeyExchange.P) + EllipticCurveKeyExchang... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets#L10-L122 | 16d254ad2c281e54d70fdf5424d0a8007da835ef | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/url_tools.ets | arkts | Jumps to an external link using want.
@param link the link | export function jump_external_link(link: string, context: Context) {
// jump to link received
const want: Want = {
uri: link
};
(context as common.UIAbilityContext).startAbility(want).then(() => {
// Pull up success
console.log('[Meow][jump_external_link] Pull up application for link ' + link + ' Su... | AST#export_declaration#Left export AST#function_declaration#Left function jump_external_link AST#parameter_list#Left ( AST#parameter#Left link : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#L... | export function jump_external_link(link: string, context: Context) {
const want: Want = {
uri: link
};
(context as common.UIAbilityContext).startAbility(want).then(() => {
console.log('[Meow][jump_external_link] Pull up application for link ' + link + ' Success!');
}).catch(() => {
cons... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L474-L486 | 2a7198ff338c985619873e24346b5d0baff41ff4 | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/MultiplexSample.ets | arkts | aboutToAppear | 当前滑动item下标 | aboutToAppear() {
this.resources.push(new MultiplexModel('1', $r('app.media.img_test_1')));
this.resources.push(new MultiplexModel('2', $r('app.media.img_test_3')));
this.resources.push(new MultiplexModel('3', $r('app.media.img_test_2')));
this.resources.push(new MultiplexModel('4', $r('app.media.img_te... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left thi... | aboutToAppear() {
this.resources.push(new MultiplexModel('1', $r('app.media.img_test_1')));
this.resources.push(new MultiplexModel('2', $r('app.media.img_test_3')));
this.resources.push(new MultiplexModel('3', $r('app.media.img_test_2')));
this.resources.push(new MultiplexModel('4', $r('app.media.img_te... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/MultiplexSample.ets#L36-L43 | b56ed4d4fd285f3dc44b23895c54149d7c3b25b2 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/Index.ets | arkts | add | 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 { add, addHspDepHar, addHspDepHsp } from "./src/main/ets/utils/Calc" | AST#export_declaration#Left export { add , addHspDepHar , addHspDepHsp } from "./src/main/ets/utils/Calc" AST#export_declaration#Right | export { add, addHspDepHar, addHspDepHsp } from "./src/main/ets/utils/Calc" | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/Sharelibraryhsp/Index.ets#L16-L16 | fcef1d2b119b06c0288e96516b83070ce413afb2 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ExpandTitle/entry/src/main/ets/utils/TitleExpansion.ets | arkts | titleExpansionContent | 默认内容样式
@returns | @Builder
titleExpansionContent(): void {
Column() {
}
.height(Constants.ONE_HUNDRED_PERCENT)
.width(Constants.ONE_HUNDRED_PERCENT)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right titleExpansionContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui... | @Builder
titleExpansionContent(): void {
Column() {
}
.height(Constants.ONE_HUNDRED_PERCENT)
.width(Constants.ONE_HUNDRED_PERCENT)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ExpandTitle/entry/src/main/ets/utils/TitleExpansion.ets#L174-L180 | 5e32d60f223e7e4aaee136c1937f8c8945027262 | gitee |
fengmingdev/protobuf-arkts-generator.git | 75888d404fd6ce52a046cba2a94807ecf1350147 | runtime/arkpb/index.ets | arkts | Reader | 二进制读取器
用于解码 Protobuf wire format | export { Reader } from './Reader' | AST#export_declaration#Left export { Reader } from './Reader' AST#export_declaration#Right | export { Reader } from './Reader' | https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L92-L92 | 796a1196a837bf4890afbcee57f1f3fce39bad02 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | FoldableGuilde/entry/src/main/ets/modules/NavigationComponent.ets | arkts | NavigationComponent | [Start NavigationComponent] | @Component
export struct NavigationComponent {
@State TooTmp: ToolbarItem = {'value': 'func', 'action': ()=> {}};
private arr: number[] = [1, 2, 3];
build() {
Column() {
// Root view container for routing navigation
Navigation() {
List({ space: 12 }) {
ForEach(this.arr, (item: s... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavigationComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right TooTmp : AST#type_annotation#Left AST#primary_type#Left ToolbarItem AST#primary_type#Right AST... | @Component
export struct NavigationComponent {
@State TooTmp: ToolbarItem = {'value': 'func', 'action': ()=> {}};
private arr: number[] = [1, 2, 3];
build() {
Column() {
Navigation() {
List({ space: 12 }) {
ForEach(this.arr, (item: string) => {
ListItem() {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/FoldableGuilde/entry/src/main/ets/modules/NavigationComponent.ets#L17-L58 | 095cd06b8510dcc1f49124d23a0ecf1fd4b987ce | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/AnimateRefresh/entry/src/main/ets/viewmodel/AnimationModel.ets | arkts | Animation model. | export default class ClassifyModel {
imgRes: Resource;
posX: number;
delay: number;
constructor(imgRes: Resource, posX: number, delay: number) {
this.imgRes = imgRes;
this.posX = posX;
this.delay = delay;
}
} | AST#export_declaration#Left export default AST#class_declaration#Left class ClassifyModel AST#class_body#Left { AST#property_declaration#Left imgRes : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left p... | export default class ClassifyModel {
imgRes: Resource;
posX: number;
delay: number;
constructor(imgRes: Resource, posX: number, delay: number) {
this.imgRes = imgRes;
this.posX = posX;
this.delay = delay;
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/viewmodel/AnimationModel.ets#L19-L29 | 597ad131bf6a33e734765ea8984b7ea506d64b1c | gitee | |
jerryzhou2/ArkTS-news-app.git | 6dfa8631948f1def4269be5a48554b99ee64a18d | fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets | arkts | Defining city type classes. | export class CityType {
public name: string;
public city: string[];
constructor(name: string, city: string[]) {
this.name = name;
this.city = city;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class CityType AST#class_body#Left { AST#property_declaration#Left public name : 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 public city... | export class CityType {
public name: string;
public city: string[];
constructor(name: string, city: string[]) {
this.name = name;
this.city = city;
}
} | https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets#L17-L25 | bb8e2b45e8d9a18f7322901581da710ddf1373f5 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | update | 更新数据
@param tableName 表名
@param data 更新的数据对象
@param whereClause 条件子句
@param whereArgs 条件参数
@returns 受影响的行数 | async update(tableName: string, data: Record<string, relationalStore.ValueType>, whereClause?: string, whereArgs?: Array<string>): Promise<number> {
try {
this.checkInitialized();
const valueBucket: relationalStore.ValuesBucket = {};
const dataEntries: [string, relationalStore.ValueType][] ... | AST#method_declaration#Left async update AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Re... | async update(tableName: string, data: Record<string, relationalStore.ValueType>, whereClause?: string, whereArgs?: Array<string>): Promise<number> {
try {
this.checkInitialized();
const valueBucket: relationalStore.ValuesBucket = {};
const dataEntries: [string, relationalStore.ValueType][] ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L248-L288 | 9ecd0ebe4f799713b937be8c2fbfb58d49488c0d | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/globalMethods/dialogs/popUpSample/PopUpSample.ets | arkts | popupBuilder | popup构造器定义弹框内容 | @Builder popupBuilder() {
Text(this.popUpText)
.fontFamily('HarmonyHeiTi')
.fontSize(14)
.fontColor('#FFFFFF')
.textAlign(TextAlign.Start)
.lineHeight(19)
.fontWeight(400)
.margin({left:16, right: 16, top: 12.5, bottom: 12.5})
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right popupBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#exp... | @Builder popupBuilder() {
Text(this.popUpText)
.fontFamily('HarmonyHeiTi')
.fontSize(14)
.fontColor('#FFFFFF')
.textAlign(TextAlign.Start)
.lineHeight(19)
.fontWeight(400)
.margin({left:16, right: 16, top: 12.5, bottom: 12.5})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/globalMethods/dialogs/popUpSample/PopUpSample.ets#L76-L85 | 42d274695b778af026df914bc7fb54f16751c616 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Default number for a week. | export enum WeekDays {
DEFAULT_NUMBER_MONDAY = 1,
DEFAULT_NUMBER_TUESDAY = 2,
DEFAULT_NUMBER_WEDNESDAY = 3,
DEFAULT_NUMBER_THURSDAY = 4,
DEFAULT_NUMBER_FRIDAY = 5,
DEFAULT_NUMBER_SATURDAY = 6,
DEFAULT_NUMBER_SUNDAY = 7
} | AST#export_declaration#Left export AST#enum_declaration#Left enum WeekDays AST#enum_body#Left { AST#enum_member#Left DEFAULT_NUMBER_MONDAY = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DEFAULT_NUMBER_TUESDAY = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right ,... | export enum WeekDays {
DEFAULT_NUMBER_MONDAY = 1,
DEFAULT_NUMBER_TUESDAY = 2,
DEFAULT_NUMBER_WEDNESDAY = 3,
DEFAULT_NUMBER_THURSDAY = 4,
DEFAULT_NUMBER_FRIDAY = 5,
DEFAULT_NUMBER_SATURDAY = 6,
DEFAULT_NUMBER_SUNDAY = 7
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/CommonConstants.ets#L134-L142 | ae19a53e8f509dac86aa5b4052b92c999a31fa84 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/NetUtil.ets | arkts | getAppNet | 获取App绑定的网络信息 | static getAppNet(): connection.NetHandle {
return connection.getAppNetSync();
} | AST#method_declaration#Left static getAppNet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#re... | static getAppNet(): connection.NetHandle {
return connection.getAppNetSync();
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L74-L76 | b2cb72d18e5211773ad91daded44a58aade4ab24 | gitee |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | common/src/main/ets/default/uicomponents/FormManagerDialog.ets | arkts | clearNoUseFormById | Keep the form which be added to the desktop, and delete the remaining forms. | private clearNoUseFormById(): void {
let id = this.mFormIdList[this.mSwiperIndex];
for (let i = 0; i < this.mFormIdList.length; i++) {
if (i != this.mSwiperIndex) {
this.mFormModel.deleteFormByFormID(this.mFormIdList[i]);
}
}
} | AST#method_declaration#Left private clearNoUseFormById 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 ... | private clearNoUseFormById(): void {
let id = this.mFormIdList[this.mSwiperIndex];
for (let i = 0; i < this.mFormIdList.length; i++) {
if (i != this.mSwiperIndex) {
this.mFormModel.deleteFormByFormID(this.mFormIdList[i]);
}
}
} | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/common/src/main/ets/default/uicomponents/FormManagerDialog.ets#L110-L117 | 5cb67ec1cfaa1976adb959b764759c18049de414 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/AxisRenderer.ets | arkts | getPaintAxisLabels | Returns the Paint object used for drawing the axis (labels).
@return | public getPaintAxisLabels(): Paint {
return this.mAxisLabelPaint;
} | AST#method_declaration#Left public getPaintAxisLabels AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Paint 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 getPaintAxisLabels(): Paint {
return this.mAxisLabelPaint;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/AxisRenderer.ets#L79-L81 | 48aa9fd4801967a60bd84c305cb3f8f326c6928a | gitee |
jerryzhou2/ArkTS-news-app.git | 6dfa8631948f1def4269be5a48554b99ee64a18d | fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets | arkts | unregisterDataChangeListener | Disable the listener for the corresponding LazyForEach component at the data source. | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
} | https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets#L52-L57 | a9eccd28054d2ba582b2ac83990738ed3c498f87 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/scanner/ScannerManager.ets | arkts | handleScanResult | 处理扫描结果(URL跳转等) | async handleScanResult(result: ScanResult): Promise<boolean> {
try {
if (result.type === 'qr' && result.text.startsWith('http')) {
Logger.info('ScannerManager', `Opening URL: ${result.text}`);
// 打开URL
return true;
}
return false;
} catch (error) {
Logger.error('S... | AST#method_declaration#Left async handleScanResult AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left ScanResult 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_... | async handleScanResult(result: ScanResult): Promise<boolean> {
try {
if (result.type === 'qr' && result.text.startsWith('http')) {
Logger.info('ScannerManager', `Opening URL: ${result.text}`);
return true;
}
return false;
} catch (error) {
Logger.error('ScannerMa... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/scanner/ScannerManager.ets#L64-L76 | 55b1846758e65d0476f88d78b21b9e992690dbf1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | 用户资料接口 | export interface UserProfile {
id: string;
username: string;
displayName: string;
avatar?: string;
bio?: string;
location?: string;
joinDate: string;
level: number;
points: number;
badges: string[];
isVerified: boolean;
isOnline: boolean;
lastActive: string;
statistics: UserStatistics;
pre... | AST#export_declaration#Left export AST#interface_declaration#Left interface UserProfile AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left username : AST#type_annotation#Left... | export interface UserProfile {
id: string;
username: string;
displayName: string;
avatar?: string;
bio?: string;
location?: string;
joinDate: string;
level: number;
points: number;
badges: string[];
isVerified: boolean;
isOnline: boolean;
lastActive: string;
statistics: UserStatistics;
pre... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L14-L30 | 0cc31bd73819335022899189d45912992ae7c601 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UsingWebMultimedia/entry2/src/main/ets/entry2ability/Entry2Ability.ets | arkts | onWindowStageDestroy | [StartExclude allow_subsequent_rendering_to_use_ui] | onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources AST#expression_statement... | onWindowStageDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UsingWebMultimedia/entry2/src/main/ets/entry2ability/Entry2Ability.ets#L41-L44 | ec1d9c1ec8a3073f19eeb55beda04a9562a02c90 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildWelcomeBanner | 欢迎横幅 - 渐变背景设计 | @Builder
buildWelcomeBanner() {
Column({ space: 12 }) {
Row() {
Column({ space: 4 }) {
Text('生日提醒助手')
.fontSize(this.getFontSize(24))
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.whitePrimary)
Text(`今天是 ${this.getCurrentDateString()} 星期... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildWelcomeBanner AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_... | @Builder
buildWelcomeBanner() {
Column({ space: 12 }) {
Row() {
Column({ space: 4 }) {
Text('生日提醒助手')
.fontSize(this.getFontSize(24))
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.whitePrimary)
Text(`今天是 ${this.getCurrentDateString()} 星期... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1291-L1344 | 21d520bb4c4eb1273f8fb9c36125f232d203fe34 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionSync.ets | arkts | encryptMessage | 加密消息 | function encryptMessage(publicKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM2_256|SM3');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, publicKey, null);
let encryptData = cipher.doFinalSync(plainText);
return encryptData;
} | AST#function_declaration#Left function encryptMessage AST#parameter_list#Left ( AST#parameter#Left publicKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Lef... | function encryptMessage(publicKey: cryptoFramework.PubKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('SM2_256|SM3');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, publicKey, null);
let encryptData = cipher.doFinalSync(plainText);
return encryptData;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceSM2/entry/src/main/ets/pages/sm2/SM2EncryptionDecryptionSync.ets#L20-L25 | e736d272fe45ade135430b17851353e7bc803719 | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/common/util/ArrayUtil.ets | arkts | subArray | 求满足条件的子数组。
@param arr 原数组。
@param predicates 筛选条件。
@returns 满足条件的子数组。 | static subArray<value_type>(
arr: Array<value_type>,
predicates: (value: value_type) => boolean
): Array<value_type> {
let results: Array<value_type> = [];
arr.forEach((value: value_type) => {
if (predicates(value)) {
results.push(value);
}
});
return results;
} | AST#method_declaration#Left static subArray AST#type_parameters#Left < AST#type_parameter#Left value_type AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_... | static subArray<value_type>(
arr: Array<value_type>,
predicates: (value: value_type) => boolean
): Array<value_type> {
let results: Array<value_type> = [];
arr.forEach((value: value_type) => {
if (predicates(value)) {
results.push(value);
}
});
return results;
} | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/common/util/ArrayUtil.ets#L11-L22 | 8484b77b0fef7597159c0573d9ae2cfaab57a824 | github |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | unSubscribeLoginOutEvent | 取消订阅登出事件 | unSubscribeLoginOutEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_LOGIN_OUT, key);
} | AST#method_declaration#Left unSubscribeLoginOutEvent AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST... | unSubscribeLoginOutEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_LOGIN_OUT, key);
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L218-L220 | e86856cef4f2af4673e0a5a49a10ff7f676ed864 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLP/entry/src/main/ets/feature/FileManager.ets | arkts | createFile | 新增文件 | async createFile(sourceUri: string, displayName: string): Promise<number> {
Logger.info(`SourceUri:${sourceUri}----displayName:${displayName}`);
try {
// fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取
let fileUri = await this.fileAccessHelper.createFile(sourceUri, displayName);
l... | AST#method_declaration#Left async createFile AST#parameter_list#Left ( AST#parameter#Left sourceUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left displayName : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | async createFile(sourceUri: string, displayName: string): Promise<number> {
Logger.info(`SourceUri:${sourceUri}----displayName:${displayName}`);
try {
let fileUri = await this.fileAccessHelper.createFile(sourceUri, displayName);
let file = fs.openSync(fileUri, fs.OpenMode.READ_WRITE);
L... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/FileManager.ets#L145-L158 | b4420ac71561965b74af80c3920a736d89d80c8b | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | loadDownloads | 加载下载列表 | async loadDownloads() {
try {
const db = DatabaseService.getInstance();
const downloadService = DownloadService.getInstance();
const allEpisodes = await db.getAllEpisodes();
// 获取正在下载的任务(从内存中获取实时进度)
const activeTasks = downloadService.getAllDownloadTasks();
const activeTas... | AST#method_declaration#Left async loadDownloads AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left db = AST#expression#Left AST#call_e... | async loadDownloads() {
try {
const db = DatabaseService.getInstance();
const downloadService = DownloadService.getInstance();
const allEpisodes = await db.getAllEpisodes();
const activeTasks = downloadService.getAllDownloadTasks();
const activeTaskMap = new Map(activeTas... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L100-L131 | 34abab8fb361f955ec0901b4ac99438eb0c4d5db | github |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/form/src/main/ets/default/view/FormServiceComponent.ets | arkts | cancelFormDialog | When click cancel dialog, this function will be called. | cancelFormDialog(): void {
this.clearForm();
} | AST#method_declaration#Left cancelFormDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | cancelFormDialog(): void {
this.clearForm();
} | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/form/src/main/ets/default/view/FormServiceComponent.ets#L176-L178 | 1a00da98d6385087e6e51cdff9312bb2ebc1b190 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/CategoryListSample/entry/src/main/ets/view/DetailListComponent.ets | arkts | DetailListComponent | This is the general detail page component that can add multiple items to the list. | @Component
export struct DetailListComponent {
build() {
Column() {
List() {
ForEach(CategoryModel.getDetailData(), (listItemData: ListItemData) => {
ListItem() {
Row() {
Text(listItemData.title)
.fontSize($r('app.float.sub_title_left_size'))
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DetailListComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_b... | @Component
export struct DetailListComponent {
build() {
Column() {
List() {
ForEach(CategoryModel.getDetailData(), (listItemData: ListItemData) => {
ListItem() {
Row() {
Text(listItemData.title)
.fontSize($r('app.float.sub_title_left_size'))
... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategoryListSample/entry/src/main/ets/view/DetailListComponent.ets#L8-L45 | 0b21b5cdfd214a98601b9e8e7656395ca0f4d359 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api15/entry/src/main/ets/MainAbility/pages/data/MyBasicSource.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 MyBasicSource implements IDataSource {
private list: number[] = []
private listeners: DataChangeListener[] = []
constructor | AST#export_declaration#Left export AST#ERROR#Left class MyBasicSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right { AST#property_declaration#Left private list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST... | export class MyBasicSource implements IDataSource {
private list: number[] = []
private listeners: DataChangeListener[] = []
constructor | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api15/entry/src/main/ets/MainAbility/pages/data/MyBasicSource.ets#L15-L19 | c09d226248403db8cde139df1e422b8c6405d40b | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraServiceUint.ets | arkts | releaseCamera | 释放会话和相关参数 | async releaseCamera(): Promise<void> {
logger.info(TAG, 'releaseCamera is called');
try {
await this.receiver?.release();
} catch (err) {
logger.error(TAG, `imageReceiver release fail: error: ${JSON.stringify(err)}`);
}
try {
await this.previewOutput?.release();
} catch (err) {... | AST#method_declaration#Left async releaseCamera AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async releaseCamera(): Promise<void> {
logger.info(TAG, 'releaseCamera is called');
try {
await this.receiver?.release();
} catch (err) {
logger.error(TAG, `imageReceiver release fail: error: ${JSON.stringify(err)}`);
}
try {
await this.previewOutput?.release();
} catch (err) {... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraServiceUint.ets#L187-L216 | b2f2ec233e24bcfcab6ce857f5ad503af67bfaad | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | registerCameraStatusChange | Registers the callback function for changing the camera status.
@param err - Error information
@param cameraStatusInfo - Camera status information
@returns No return value | registerCameraStatusChange(err: BusinessError, cameraStatusInfo: camera.CameraStatusInfo): void {
if (err) {
Logger.info(TAG, `registerCameraStatusChange err:${err.code}`)
return;
}
Logger.info(TAG, `cameraId: ${cameraStatusInfo.camera.cameraId},status: ${cameraStatusInfo.status}`);
} | AST#method_declaration#Left registerCameraStatusChange AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cameraStatusInfo : AST#type_annotation#Left AST#primary_type#Le... | registerCameraStatusChange(err: BusinessError, cameraStatusInfo: camera.CameraStatusInfo): void {
if (err) {
Logger.info(TAG, `registerCameraStatusChange err:${err.code}`)
return;
}
Logger.info(TAG, `cameraId: ${cameraStatusInfo.camera.cameraId},status: ${cameraStatusInfo.status}`);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L580-L586 | fec78e17d08f617d0bcfd62afad75b83cf534083 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/entity/UserEntity.ets | arkts | token类型 | constructor(token?: String, expiresIn?: String, refreshToken?: String, expiresAt?: String, tokenType?: String) {
this.token = token;
this.expiresIn = expiresIn;
this.refreshToken = refreshToken;
this.expiresAt = expiresAt;
this.tokenType = tokenType;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left token ? : AST#type_annotation#Left AST#primary_type#Left String AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left expiresIn ? : AST#type_annotation#Left AST#primary_type#Left String AST#prim... | constructor(token?: String, expiresIn?: String, refreshToken?: String, expiresAt?: String, tokenType?: String) {
this.token = token;
this.expiresIn = expiresIn;
this.refreshToken = refreshToken;
this.expiresAt = expiresAt;
this.tokenType = tokenType;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/entity/UserEntity.ets#L23-L29 | dcbca4e79d3b5b259bd8701ba5e40970942eafb0 | gitee | |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | isExposureBiasRange | 曝光补偿 | isExposureBiasRange(exposureBias: number): void {
Logger.debug(TAG, `setExposureBias value ${exposureBias}`);
// 查询曝光补偿范围
let biasRangeArray: Array<number> | undefined = [];
biasRangeArray = this.session?.getExposureBiasRange();
Logger.debug(TAG, `getExposureBiasRange success, biasRangeArray: ${JSON... | AST#method_declaration#Left isExposureBiasRange AST#parameter_list#Left ( AST#parameter#Left exposureBias : 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#prim... | isExposureBiasRange(exposureBias: number): void {
Logger.debug(TAG, `setExposureBias value ${exposureBias}`);
let biasRangeArray: Array<number> | undefined = [];
biasRangeArray = this.session?.getExposureBiasRange();
Logger.debug(TAG, `getExposureBiasRange success, biasRangeArray: ${JSON.stringify(... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L831-L839 | a873056906fd2fd70cffa676f27d65d0673bcb16 | gitee |
jltfcloudcn/jump_to | 842b765e399817306e1fad30e32ac91143d3f87c | PageTransitionAnimation/entry/src/main/ets/default/pages/page1.ets | arkts | pageTransition | 自定义方式1:完全自定义转场过程的效果 | pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale = 1
this.opacity = progress
}) // 进场过程中会逐帧触发onEnter回调,入参为动效的归一化进度(0% -- 100%)
PageTransitionExit({ duration: 1500, curve: Curve.Ease })
.... | AST#method_declaration#Left pageTransition 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 PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression... | pageTransition() {
PageTransitionEnter({ duration: 1200, curve: Curve.Linear })
.onEnter((type: RouteType, progress: number) => {
this.scale = 1
this.opacity = progress
})
PageTransitionExit({ duration: 1500, curve: Curve.Ease })
.onExit((type: RouteType, progress: number) => ... | https://github.com/jltfcloudcn/jump_to/blob/842b765e399817306e1fad30e32ac91143d3f87c/PageTransitionAnimation/entry/src/main/ets/default/pages/page1.ets#L16-L27 | ac2a9647c3361519cf8fe6c08b0bce7f4feb049f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | delete | 删除键值对
@param key 键 | async delete(key: string): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.delete(key);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed... | AST#method_declaration#Left async delete AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise... | async delete(key: string): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.delete(key);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L251-L261 | 84f07e67718014485a1bcd660efdc2f390e0e61d | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | getBeforeDayStr | 获取前一天日期,返回字符串 | static getBeforeDayStr(date: number | string | Date, format: string = DATE_FORMAT4): string {
return DateUtils.getAmountDayStr(date, -1, format);
} | AST#method_declaration#Left static getBeforeDayStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type... | static getBeforeDayStr(date: number | string | Date, format: string = DATE_FORMAT4): string {
return DateUtils.getAmountDayStr(date, -1, format);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L284-L286 | 3438be8b4f2828c362cbd02d04b40c3ab0db6700 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/interceptors/AppInterceptors.ets | arkts | @file 全局网络拦截器注册
@author Joker.X
配置全局网络拦截器
@param {AxiosInstance} axiosInstance - Axios 实例
@returns {void} 无返回值 | export function setupInterceptors(axiosInstance: AxiosInstance): void {
setupLogInterceptor(axiosInstance);
// 请求拦截器
axiosInstance.interceptors.request.use(
async (config: InternalAxiosRequestConfig): Promise<InternalAxiosRequestConfig> => {
const tokenStore: TokenStoreDataSource = new TokenStoreDataSo... | AST#export_declaration#Left export AST#function_declaration#Left function setupInterceptors AST#parameter_list#Left ( AST#parameter#Left axiosInstance : AST#type_annotation#Left AST#primary_type#Left AxiosInstance AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type... | export function setupInterceptors(axiosInstance: AxiosInstance): void {
setupLogInterceptor(axiosInstance);
axiosInstance.interceptors.request.use(
async (config: InternalAxiosRequestConfig): Promise<InternalAxiosRequestConfig> => {
const tokenStore: TokenStoreDataSource = new TokenStoreDataSourceImpl... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/AppInterceptors.ets#L15-L44 | 6b8d037884c7b9dd86613f258ad35f18382e9108 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Row.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
RowSpaceAroundBottom() { Text("A"); Text("B"); Text("C"); } | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#L... | build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginVa... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1404-L1419 | 6ba5d4989370a781cbc668b0d8b875cb2dd363f5 | github | |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 未读消息数量
@param date
@returns | export function getRankList(page:number) {
return axiosClient.get<RankModel>({
url: `coin/rank/${page}/json`,
showLoading:true
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getRankList AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#s... | export function getRankList(page:number) {
return axiosClient.get<RankModel>({
url: `coin/rank/${page}/json`,
showLoading:true
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L301-L306 | 2e29dbb6881066717ce6e0fe0b53dc2fea0cb430 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/entryability/EntryAbility.ets | arkts | setContext | 设置上下文引用 | static setContext(context: common.Context): void {
AppContext.context = context;
hilog.info(DOMAIN, TAG, 'AppContext: 已保存UIAbility上下文引用');
} | AST#method_declaration#Left static setContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type... | static setContext(context: common.Context): void {
AppContext.context = context;
hilog.info(DOMAIN, TAG, 'AppContext: 已保存UIAbility上下文引用');
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/entryability/EntryAbility.ets#L14-L17 | 46f58475611576861ada5df5bd5930a767e542e9 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_user_agents.ets | arkts | add_user_agent | Add a new user agent to the current user agent list.
@param se A user_agent object, the user agent to be added. | static add_user_agent(ua: user_agent) {
bunch_of_user_agents.list_of_user_agents.push(ua);
bunch_of_user_agents.update_last_accessed();
} | AST#method_declaration#Left static add_user_agent AST#parameter_list#Left ( AST#parameter#Left ua : AST#type_annotation#Left AST#primary_type#Left user_agent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST... | static add_user_agent(ua: user_agent) {
bunch_of_user_agents.list_of_user_agents.push(ua);
bunch_of_user_agents.update_last_accessed();
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_user_agents.ets#L38-L41 | bd1a768d2c8a807e4df1a97adde5922c27fe7c47 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageflip/src/main/ets/datasource/BasicDataSource.ets | arkts | unregisterDataChangeListener | 该方法为框架侧调用,为对应的LazyForEach组件在数据源处去除listener监听 | public unregisterDataChangeListener(listener: DataChangeListener): void {
this.listeners.delete(listener);
} | AST#method_declaration#Left public unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary... | public unregisterDataChangeListener(listener: DataChangeListener): void {
this.listeners.delete(listener);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/datasource/BasicDataSource.ets#L49-L51 | e6a6f255544b8e4a7563603886cd4d274d83b9fd | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleNotificationManager.ets | arkts | 简化的提醒设置接口 | export interface SimpleReminderSettings {
taskReminderEnabled: boolean;
pomodoroNotificationEnabled: boolean;
dailySummaryEnabled: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SimpleReminderSettings AST#object_type#Left { AST#type_member#Left taskReminderEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left pomodo... | export interface SimpleReminderSettings {
taskReminderEnabled: boolean;
pomodoroNotificationEnabled: boolean;
dailySummaryEnabled: boolean;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L14-L18 | fc313bbb3e7fc47e862c4a1cc35224588f27f5cc | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | onEnvironment | 注册对系统环境变化的监听。使用callback异步回调。仅支持主线程调用。
@param callback 回调方法,提供应用上下文ApplicationContext对系统环境变量监听回调的能力。
@returns 返回的此次注册监听系统环境变化的ID(每次注册该ID会自增+1,当超过监听上限数量2^63-1时,返回-1)。 | static onEnvironment(callback: EnvironmentCallback): number {
return AppUtil.getApplicationContext().on('environment', callback);
} | AST#method_declaration#Left static onEnvironment AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left EnvironmentCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left num... | static onEnvironment(callback: EnvironmentCallback): number {
return AppUtil.getApplicationContext().on('environment', callback);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L284-L286 | 71ea532a90064737f875e600dfd2921bdd9d2499 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecomment/src/main/ets/components/view/CommentInputDialog.ets | arkts | CommentInputDialog | 输入评论弹窗,用于输入文字和图片评论
实现步骤:
1.添加相机按钮、发布按钮
2.点击按钮时通过startAbilityForResult接口拉起相机
3.拍照后获取相机返回的照片地址,并显示在列表中
4.点击发布按钮,将评论添加到列表中 | @CustomDialog
export struct CommentInputDialog {
// 选择的照片列表
@State selectedImages: string[] = [];
// 输入的文字
@State text: string = "";
@Link textInComment: string;
@Link imagesInComment: string[];
@StorageLink('bottomHeight') bottomHeight: number = 0; // 底部导航栏高度
controller?: CustomDialogController;
// 发... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommentInputDialog AST#component_body#Left { // 选择的照片列表 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectedImages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Le... | @CustomDialog
export struct CommentInputDialog {
@State selectedImages: string[] = [];
@State text: string = "";
@Link textInComment: string;
@Link imagesInComment: string[];
@StorageLink('bottomHeight') bottomHeight: number = 0;
controller?: CustomDialogController;
publish: () => void = (): voi... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/view/CommentInputDialog.ets#L34-L137 | 4decc390285f2cd0f843bec4e5a36ef5d2587993 | gitee |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/pages/MainPage.ets | arkts | MainPage | 添加 @HMRouter 注解 | @HMRouter({
pageUrl: 'MainPage',
lifecycle: 'ExitAppLifecycle'
})
@Component
export struct MainPage {
@State currentIndex: number = 0;
private tabsController: TabsController = new TabsController();
@Builder TabBuilder(item: TabItemInterface) {
Column() {
Divider().strokeWidth(0.5).color('#E3E3E3').... | AST#decorated_export_declaration#Left AST#decorator#Left @ HMRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left pageUrl AST#property_name#Right : AST#expression#Left 'MainPage' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#p... | @HMRouter({
pageUrl: 'MainPage',
lifecycle: 'ExitAppLifecycle'
})
@Component
export struct MainPage {
@State currentIndex: number = 0;
private tabsController: TabsController = new TabsController();
@Builder TabBuilder(item: TabItemInterface) {
Column() {
Divider().strokeWidth(0.5).color('#E3E3E3').... | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/MainPage.ets#L9-L52 | dde607cb021d5433a9e1da89aa1d81ca6170ac7c | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.