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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/utils/ui_tools.ets
|
arkts
|
Listens to the Free-window Mode change and automatically switch modes.
@param context
@param windowClass
@param storage
@param id
|
export function listen_free_window_mode(context: Context, windowClass: window.Window, storage: LocalStorage, id: string) {
console.log(`[listen_free_window_mode] ON for window ${id}!`)
settings.registerKeyObserver(context, 'window_pcmode_switch_status', settings.domainName.USER_PROPERTY,
() => {
settings.getValue(context, 'window_pcmode_switch_status', settings.domainName.USER_PROPERTY)
.then((val) => {
let free = (val == 'true');
// Only sets AppStorage if I am the lord of the windows
if (AppStorage.get('THE_LORD_OF_THE_WINDOWS') as string == id) {
console.log('[free][listen_free_window_mode] Detected Free-window mode change! [' + val + ']');
if (free) {
AppStorage.setOrCreate('free_window_mode', true);
console.log('[free][listen_free_window_mode] Set AppStorage Free-window mode to true!');
} else {
AppStorage.setOrCreate('free_window_mode', false);
console.log('[free][listen_free_window_mode] Set AppStorage Free-window mode to false!');
}
}
});
})
}
|
AST#export_declaration#Left export AST#function_declaration#Left function listen_free_window_mode AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [listen_free_window_mode] ON for window AST#template_substitution#Left $ { AST#expression#Left id AST#expression#Right } AST#template_substitution#Right ! ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left settings AST#expression#Right . registerKeyObserver AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left 'window_pcmode_switch_status' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left settings AST#expression#Right . domainName AST#member_expression#Right AST#expression#Right . USER_PROPERTY AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left settings AST#expression#Right . getValue AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left 'window_pcmode_switch_status' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left settings AST#expression#Right . domainName AST#member_expression#Right AST#expression#Right . USER_PROPERTY AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left val AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left free = AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left val AST#expression#Right == AST#expression#Left 'true' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Only sets AppStorage if I am the lord of the windows AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'THE_LORD_OF_THE_WINDOWS' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right == AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[free][listen_free_window_mode] Detected Free-window mode change! [' AST#expression#Right + AST#expression#Left val AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left free AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'free_window_mode' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[free][listen_free_window_mode] Set AppStorage Free-window mode to true!' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'free_window_mode' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[free][listen_free_window_mode] Set AppStorage Free-window mode to false!' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function listen_free_window_mode(context: Context, windowClass: window.Window, storage: LocalStorage, id: string) {
console.log(`[listen_free_window_mode] ON for window ${id}!`)
settings.registerKeyObserver(context, 'window_pcmode_switch_status', settings.domainName.USER_PROPERTY,
() => {
settings.getValue(context, 'window_pcmode_switch_status', settings.domainName.USER_PROPERTY)
.then((val) => {
let free = (val == 'true');
if (AppStorage.get('THE_LORD_OF_THE_WINDOWS') as string == id) {
console.log('[free][listen_free_window_mode] Detected Free-window mode change! [' + val + ']');
if (free) {
AppStorage.setOrCreate('free_window_mode', true);
console.log('[free][listen_free_window_mode] Set AppStorage Free-window mode to true!');
} else {
AppStorage.setOrCreate('free_window_mode', false);
console.log('[free][listen_free_window_mode] Set AppStorage Free-window mode to false!');
}
}
});
})
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L292-L313
|
9b5b477e9a1531d70917ccb48893bf1d6fbe8f29
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
|
arkts
|
showFallbackLanguageDialog
|
显示回退语言对话框
|
private showFallbackLanguageDialog(): void {
// TODO: 实现回退语言选择对话框
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Show fallback language dialog');
}
|
AST#method_declaration#Left private showFallbackLanguageDialog 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 { // TODO: 实现回退语言选择对话框 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left 'Show fallback language dialog' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private showFallbackLanguageDialog(): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Show fallback language dialog');
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L624-L627
|
533aad57357fc1d8575d53187d50436f806000dc
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
提醒设置接口
|
export interface ReminderSettings {
enabled: boolean;
advanceDays: number[];
frequency: ReminderFrequency;
customTime: string;
weekendReminder: boolean;
lunarBirthdayReminder: boolean;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ReminderSettings AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left advanceDays : 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#type_member#Right ; AST#type_member#Left frequency : AST#type_annotation#Left AST#primary_type#Left ReminderFrequency AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left customTime : 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 weekendReminder : 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 lunarBirthdayReminder : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ReminderSettings {
enabled: boolean;
advanceDays: number[];
frequency: ReminderFrequency;
customTime: string;
weekendReminder: boolean;
lunarBirthdayReminder: boolean;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L529-L536
|
972fd042e1702593a3aa3275b50fc29132037382
|
github
|
|
2763981847/Clock-Alarm.git
|
8949bedddb7d011021848196735f30ffe2bd1daf
|
entry/src/main/ets/view/WorldClock/ClockArea.ets
|
arkts
|
drawClockArea
|
开始绘制时钟区域
|
private drawClockArea(): void {
if (!this.isReady) {
return;
}
this.renderContext.clearRect(
-this.canvasSize,
-this.canvasSize / CommonConstants.DEFAULT_DOUBLE,
this.canvasSize * CommonConstants.DEFAULT_DOUBLE,
this.canvasSize);
let date = new Date(this.now);
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
this.drawPan();
this.drawPointer(
CommonConstants.DEFAULT_INTERVAL_MINUTE_MAX * (hours > CommonConstants.DEFAULT_TOTAL_HOUR
? hours - CommonConstants.DEFAULT_TOTAL_HOUR
: hours)
+ minutes / CommonConstants.DEFAULT_TOTAL_HOUR * CommonConstants.DEFAULT_COMMON_DEGREE,
AlarmClockConstants.HOUR_POINTER_IMAGE_URL);
this.drawPointer(CommonConstants.DEFAULT_COMMON_DEGREE * minutes, AlarmClockConstants.MINUTE_POINTER_IMAGE_URL);
this.drawPointer(CommonConstants.DEFAULT_COMMON_DEGREE * seconds, AlarmClockConstants.SECOND_POINTER_IMAGE_URL);
}
|
AST#method_declaration#Left private drawClockArea AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isReady AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderContext AST#member_expression#Right AST#expression#Right . clearRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . canvasSize AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . canvasSize AST#member_expression#Right AST#expression#Right / AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_DOUBLE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canvasSize AST#member_expression#Right AST#expression#Right * AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_DOUBLE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canvasSize AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . now AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hours = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minutes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left seconds = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getSeconds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#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 . drawPan AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#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 . drawPointer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_INTERVAL_MINUTE_MAX AST#member_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left hours AST#expression#Right > AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_TOTAL_HOUR AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left hours AST#expression#Right - AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_TOTAL_HOUR AST#member_expression#Right AST#expression#Right : AST#expression#Left hours AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left minutes AST#expression#Right / AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_TOTAL_HOUR AST#member_expression#Right AST#expression#Right * AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEFAULT_COMMON_DEGREE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AlarmClockConstants AST#expression#Right . HOUR_POINTER_IMAGE_URL AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#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 . drawPointer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_COMMON_DEGREE AST#member_expression#Right AST#expression#Right * AST#expression#Left minutes AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AlarmClockConstants AST#expression#Right . MINUTE_POINTER_IMAGE_URL AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#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 . drawPointer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEFAULT_COMMON_DEGREE AST#member_expression#Right AST#expression#Right * AST#expression#Left seconds AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AlarmClockConstants AST#expression#Right . SECOND_POINTER_IMAGE_URL AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private drawClockArea(): void {
if (!this.isReady) {
return;
}
this.renderContext.clearRect(
-this.canvasSize,
-this.canvasSize / CommonConstants.DEFAULT_DOUBLE,
this.canvasSize * CommonConstants.DEFAULT_DOUBLE,
this.canvasSize);
let date = new Date(this.now);
let hours = date.getHours();
let minutes = date.getMinutes();
let seconds = date.getSeconds();
this.drawPan();
this.drawPointer(
CommonConstants.DEFAULT_INTERVAL_MINUTE_MAX * (hours > CommonConstants.DEFAULT_TOTAL_HOUR
? hours - CommonConstants.DEFAULT_TOTAL_HOUR
: hours)
+ minutes / CommonConstants.DEFAULT_TOTAL_HOUR * CommonConstants.DEFAULT_COMMON_DEGREE,
AlarmClockConstants.HOUR_POINTER_IMAGE_URL);
this.drawPointer(CommonConstants.DEFAULT_COMMON_DEGREE * minutes, AlarmClockConstants.MINUTE_POINTER_IMAGE_URL);
this.drawPointer(CommonConstants.DEFAULT_COMMON_DEGREE * seconds, AlarmClockConstants.SECOND_POINTER_IMAGE_URL);
}
|
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/WorldClock/ClockArea.ets#L32-L54
|
66e7325cc54e3aadd5e1f9c9a85699ee4730ed65
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/network/src/main/ets/datasource/auth/AuthNetworkDataSource.ets
|
arkts
|
@file 认证相关网络数据源接口
定义认证模块所需的所有网络请求操作
@author Joker.X
|
export interface AuthNetworkDataSource {
/**
* 微信 APP 授权登录
* @param {Record<string, string>} params - 微信授权参数
* @returns {Promise<NetworkResponse<Auth>>} 认证结果
*/
loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
/**
* QQ APP 授权登录
* @param {QQLoginRequest} params - QQ 授权参数
* @returns {Promise<NetworkResponse<Auth>>} 认证结果
*/
loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>>;
/**
* 用户注册
* @param {Record<string, string>} params - 注册参数
* @returns {Promise<NetworkResponse<Auth>>} 注册结果
*/
register(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
/**
* 获取短信验证码
* @param {Record<string, string>} params - 验证码请求参数
* @returns {Promise<NetworkResponse<string>>} 短信验证码发送结果
*/
getSmsCode(params: Record<string, string>): Promise<NetworkResponse<string>>;
/**
* 刷新 Token
* @param {Record<string, string>} params - 刷新参数,包含 refresh_token
* @returns {Promise<NetworkResponse<Auth>>} 刷新后的认证信息
*/
refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
/**
* 手机号验证码登录
* @param {Record<string, string>} params - 手机号登录参数
* @returns {Promise<NetworkResponse<Auth>>} 登录结果
*/
loginByPhone(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
/**
* 密码登录
* @param params 登录参数,包含用户名、密码等
* @return 返回 Promise,包含认证结果
*/
loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>>;
/**
* 获取图片验证码
* @returns {Promise<NetworkResponse<Captcha>>} 图片验证码
*/
getCaptcha(): Promise<NetworkResponse<Captcha>>;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface AuthNetworkDataSource AST#object_type#Left { /**
* 微信 APP 授权登录
* @param {Record<string, string>} params - 微信授权参数
* @returns {Promise<NetworkResponse<Auth>>} 认证结果
*/ AST#type_member#Left loginByWxApp AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* QQ APP 授权登录
* @param {QQLoginRequest} params - QQ 授权参数
* @returns {Promise<NetworkResponse<Auth>>} 认证结果
*/ AST#type_member#Left loginByQqApp AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left QQLoginRequest 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 用户注册
* @param {Record<string, string>} params - 注册参数
* @returns {Promise<NetworkResponse<Auth>>} 注册结果
*/ AST#type_member#Left register AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 获取短信验证码
* @param {Record<string, string>} params - 验证码请求参数
* @returns {Promise<NetworkResponse<string>>} 短信验证码发送结果
*/ AST#type_member#Left getSmsCode AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 刷新 Token
* @param {Record<string, string>} params - 刷新参数,包含 refresh_token
* @returns {Promise<NetworkResponse<Auth>>} 刷新后的认证信息
*/ AST#type_member#Left refreshToken AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 手机号验证码登录
* @param {Record<string, string>} params - 手机号登录参数
* @returns {Promise<NetworkResponse<Auth>>} 登录结果
*/ AST#type_member#Left loginByPhone AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 密码登录
* @param params 登录参数,包含用户名、密码等
* @return 返回 Promise,包含认证结果
*/ AST#type_member#Left loginByPassword AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PasswordLoginRequest 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* 获取图片验证码
* @returns {Promise<NetworkResponse<Captcha>>} 图片验证码
*/ AST#type_member#Left getCaptcha AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Captcha AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface AuthNetworkDataSource {
loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
loginByQqApp(params: QQLoginRequest): Promise<NetworkResponse<Auth>>;
register(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
getSmsCode(params: Record<string, string>): Promise<NetworkResponse<string>>;
refreshToken(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
loginByPhone(params: Record<string, string>): Promise<NetworkResponse<Auth>>;
loginByPassword(params: PasswordLoginRequest): Promise<NetworkResponse<Auth>>;
getCaptcha(): Promise<NetworkResponse<Captcha>>;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSource.ets#L8-L63
|
7d5f56264707219f9c7fd5f3e2c38f7a2e33cc62
|
github
|
|
wuyuanwuhui999/harmony-arkts-movie-app-ui.git
|
d5e9bebe1dca2759cba417d2b6b402941d3bc273
|
entry/src/main/ets/pages/MoviePlayPage.ets
|
arkts
|
getGroup
|
@author: wuwenqiang
@description: 电影播放地址分组
@date: 2025-01-7 23:49
|
getGroup(movieUrlList:Array<MovieUrlInterface>):Array<Array<MovieUrlInterface|null>>{
const movieUrlGroup:Array<Array<MovieUrlInterface>> = [];
let myMovieUrlList:Array<MovieUrlInterface|null>
movieUrlList.forEach((item:MovieUrlInterface,index:number)=>{
if(movieUrlGroup.length === 0 || movieUrlGroup[movieUrlGroup.length - 1].length === 4){
myMovieUrlList = [];
movieUrlGroup.push(myMovieUrlList)
}else{
myMovieUrlList = movieUrlGroup[movieUrlGroup.length - 1]
}
myMovieUrlList.push(item)
})
if(movieUrlGroup[movieUrlGroup.length - 1].length < 4){
for(let i = 0; i < 4 - movieUrlGroup[movieUrlGroup.length - 1].length; i++){
movieUrlGroup[movieUrlGroup.length - 1].push(null)
}
}
return movieUrlGroup
}
|
AST#method_declaration#Left getGroup AST#parameter_list#Left ( AST#parameter#Left movieUrlList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left MovieUrlInterface AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right 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 Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left MovieUrlInterface AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left movieUrlGroup : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left MovieUrlInterface AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left let AST#variable_declarator#Left myMovieUrlList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left MovieUrlInterface AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right movieUrl List . AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left forEach AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left MovieUrlInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#subscript_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left myMovieUrlList = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left myMovieUrlList AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left myMovieUrlList = AST#expression#Left AST#subscript_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left myMovieUrlList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left AST#binary_expression#Left AST#expression#Left 4 AST#expression#Right - AST#expression#Left AST#subscript_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left movieUrlGroup AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left movieUrlGroup AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getGroup(movieUrlList:Array<MovieUrlInterface>):Array<Array<MovieUrlInterface|null>>{
const movieUrlGroup:Array<Array<MovieUrlInterface>> = [];
let myMovieUrlList:Array<MovieUrlInterface|null>
movieUrlList.forEach((item:MovieUrlInterface,index:number)=>{
if(movieUrlGroup.length === 0 || movieUrlGroup[movieUrlGroup.length - 1].length === 4){
myMovieUrlList = [];
movieUrlGroup.push(myMovieUrlList)
}else{
myMovieUrlList = movieUrlGroup[movieUrlGroup.length - 1]
}
myMovieUrlList.push(item)
})
if(movieUrlGroup[movieUrlGroup.length - 1].length < 4){
for(let i = 0; i < 4 - movieUrlGroup[movieUrlGroup.length - 1].length; i++){
movieUrlGroup[movieUrlGroup.length - 1].push(null)
}
}
return movieUrlGroup
}
|
https://github.com/wuyuanwuhui999/harmony-arkts-movie-app-ui.git/blob/d5e9bebe1dca2759cba417d2b6b402941d3bc273/entry/src/main/ets/pages/MoviePlayPage.ets#L89-L107
|
cd6d676732f1ab7226e364ef03a1a98839330d17
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets
|
arkts
|
hmac
|
消息认证码计算
@param str 计算字符串
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns
|
static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.hmac(str, 'SM3', resultCoding);
}
|
AST#method_declaration#Left static hmac AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DynamicSyncUtil AST#expression#Right . hmac AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 'SM3' AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return DynamicSyncUtil.hmac(str, 'SM3', resultCoding);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM3Sync.ets#L44-L46
|
a85c00f1d626d83f34b284fc0b326bb4d25b75ec
|
gitee
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/accuracy/path_sensitive/loop_stmt/while_body_001_T.ets
|
arkts
|
Introduction 循环结构-body语句
Level 3
|
export function while_body_001_T(taint_src : string) {
let i = 0
let res = ""
while (i < 2) {
res = taint_src
i++
}
taint.Sink(res)
}
|
AST#export_declaration#Left export AST#function_declaration#Left function while_body_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res = AST#expression#Left "" AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left res = AST#expression#Left taint_src AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left res AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function while_body_001_T(taint_src : string) {
let i = 0
let res = ""
while (i < 2) {
res = taint_src
i++
}
taint.Sink(res)
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/loop_stmt/while_body_001_T.ets#L8-L16
|
3364a4712b8ea08b52608b382cbb6399c4d1bd11
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_seg_encryption_decryption/aes_gcm_seg_encryption_decryption_synchronous.ets
|
arkts
|
decryptMessage
|
分段解密消息
|
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|GCM|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let updateLength = 20; // 假设以20字节为单位进行分段update,实际并无要求
let decryptText = new Uint8Array();
for (let i = 0; i < cipherText.data.length; i += updateLength) {
let updateMessage = cipherText.data.subarray(i, i + updateLength);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
// 分段update
let updateOutput = decoder.updateSync(updateMessageBlob);
// 把update的结果拼接起来,得到明文
let mergeText = new Uint8Array(decryptText.length + updateOutput.data.length);
mergeText.set(decryptText);
mergeText.set(updateOutput.data, decryptText.length);
decryptText = mergeText;
}
let decryptData = decoder.doFinalSync(null);
if (decryptData == null) {
console.info('GCM decrypt success, decryptData is null');
}
let decryptBlob: cryptoFramework.DataBlob = { data: decryptText };
return decryptBlob;
}
|
AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cipherText : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES128|GCM|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decoder AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . DECRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left gcmParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateLength = AST#expression#Left 20 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 假设以20字节为单位进行分段update,实际并无要求 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptText = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left cipherText AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left updateLength AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipherText AST#expression#Right . data AST#member_expression#Right AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left updateLength AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateMessageBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateMessage AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 分段update AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decoder AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateMessageBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 把update的结果拼接起来,得到明文 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mergeText = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decryptText AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left updateOutput AST#expression#Right AST#binary_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mergeText AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left decryptText AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mergeText AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left decryptText AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left decryptText = AST#expression#Left mergeText AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left decoder AST#expression#Right . doFinalSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left decryptData AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'GCM decrypt success, decryptData is null' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decryptBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left decryptText AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left decryptBlob AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|GCM|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, gcmParams);
let updateLength = 20;
let decryptText = new Uint8Array();
for (let i = 0; i < cipherText.data.length; i += updateLength) {
let updateMessage = cipherText.data.subarray(i, i + updateLength);
let updateMessageBlob: cryptoFramework.DataBlob = { data: updateMessage };
let updateOutput = decoder.updateSync(updateMessageBlob);
let mergeText = new Uint8Array(decryptText.length + updateOutput.data.length);
mergeText.set(decryptText);
mergeText.set(updateOutput.data, decryptText.length);
decryptText = mergeText;
}
let decryptData = decoder.doFinalSync(null);
if (decryptData == null) {
console.info('GCM decrypt success, decryptData is null');
}
let decryptBlob: cryptoFramework.DataBlob = { data: decryptText };
return decryptBlob;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_seg_encryption_decryption/aes_gcm_seg_encryption_decryption_synchronous.ets#L71-L93
|
203ea61fc2ab1eea2caab446b05e0e3ba3d9aaf1
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/util/CountDownTimer.ets
|
arkts
|
倒计时器工具类
提供开始、暂停、恢复、取消等功能
|
export class CountDownTimer {
/**
* 总倒计时时间(毫秒)
* */
private totalTime: number;
/**
* 间隔时间(毫秒),默认1000ms
* */
private interval: number = 1000;
/**
* 剩余时间(毫秒)
* */
private remainingTime: number;
/**
* 定时器ID
* */
private timerId: number | null = null;
/**
* 是否处于暂停状态
* */
private isPaused: boolean = false;
/**
* 倒计时中回调
* */
private onTickCallback?: (millisUntilFinished: number) => void;
/**
* 倒计时结束回调
* */
private onFinishCallback?: () => void;
/**
* 构造函数
* @param totalTime 总倒计时时间(毫秒)
* @param interval 间隔时间(毫秒),默认1000ms
*/
constructor(totalTime: number, interval: number = 1000) {
this.totalTime = totalTime;
this.interval = interval;
this.remainingTime = totalTime;
}
/**
* 设置倒计时中回调
* @param callback 回调函数,参数为剩余时间(毫秒)
*/
onTick(callback: (millisUntilFinished: number) => void): CountDownTimer {
this.onTickCallback = callback;
return this;
}
/**
* 设置倒计时结束回调
* @param callback 回调函数
*/
onFinish(callback: () => void): CountDownTimer {
this.onFinishCallback = callback;
return this;
}
/**
* 开始倒计时
*/
start(): void {
// 先取消可能存在的定时器
this.cancel();
this.isPaused = false;
this.remainingTime = this.totalTime;
// 立即触发一次回调
this.onTickCallback?.(this.remainingTime);
this.timerId = setInterval(() => {
if (this.isPaused) return;
this.remainingTime -= this.interval;
if (this.remainingTime <= 0) {
this.onTickCallback?.(0);
this.onFinishCallback?.();
this.cancel();
} else {
this.onTickCallback?.(this.remainingTime);
}
}, this.interval);
}
/**
* 暂停倒计时
*/
pause(): void {
this.isPaused = true;
}
/**
* 恢复倒计时
*/
resume(): void {
if (this.isPaused && this.remainingTime > 0) {
this.isPaused = false;
}
}
/**
* 取消倒计时
*/
cancel(): void {
if (this.timerId) {
clearInterval(this.timerId);
this.timerId = null;
}
this.isPaused = false;
}
/**
* 获取剩余时间
* @returns 剩余时间(毫秒)
*/
getRemainingTime(): number {
return this.remainingTime;
}
/**
* 重置倒计时
* @param totalTime 新的总时间(毫秒),不填则使用初始总时间
*/
reset(totalTime?: number): void {
if (totalTime) {
this.totalTime = totalTime;
}
this.remainingTime = this.totalTime;
this.isPaused = false;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CountDownTimer AST#class_body#Left { /**
* 总倒计时时间(毫秒)
* */ AST#property_declaration#Left private totalTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 间隔时间(毫秒),默认1000ms
* */ AST#property_declaration#Left private interval : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1000 AST#expression#Right ; AST#property_declaration#Right /**
* 剩余时间(毫秒)
* */ AST#property_declaration#Left private remainingTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 定时器ID
* */ AST#property_declaration#Left private timerId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 是否处于暂停状态
* */ AST#property_declaration#Left private isPaused : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 倒计时中回调
* */ AST#property_declaration#Left private onTickCallback ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left millisUntilFinished : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 倒计时结束回调
* */ AST#property_declaration#Left private onFinishCallback ? : AST#type_annotation#Left AST#function_type#Left 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#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 构造函数
* @param totalTime 总倒计时时间(毫秒)
* @param interval 间隔时间(毫秒),默认1000ms
*/ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left totalTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left interval : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1000 AST#expression#Right AST#parameter#Right ) 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 . totalTime AST#member_expression#Right = AST#expression#Left totalTime AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . interval AST#member_expression#Right = AST#expression#Left interval AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . remainingTime AST#member_expression#Right = AST#expression#Left totalTime AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right /**
* 设置倒计时中回调
* @param callback 回调函数,参数为剩余时间(毫秒)
*/ AST#method_declaration#Left onTick AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left millisUntilFinished : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CountDownTimer AST#primary_type#Right AST#type_annotation#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 . onTickCallback AST#member_expression#Right = AST#expression#Left callback AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 设置倒计时结束回调
* @param callback 回调函数
*/ AST#method_declaration#Left onFinish AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left 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#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CountDownTimer AST#primary_type#Right AST#type_annotation#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 . onFinishCallback AST#member_expression#Right = AST#expression#Left callback AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 开始倒计时
*/ AST#method_declaration#Left start AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 先取消可能存在的定时器 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cancel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPaused AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainingTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 立即触发一次回调 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 . onTickCallback AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainingTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPaused AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right 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 . remainingTime AST#member_expression#Right -= AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . interval AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainingTime AST#member_expression#Right AST#expression#Right <= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#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 . onTickCallback AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#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 . onFinishCallback AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#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 . cancel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#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 . onTickCallback AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainingTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . interval AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 暂停倒计时
*/ AST#method_declaration#Left pause AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPaused AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 恢复倒计时
*/ AST#method_declaration#Left resume AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPaused AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . remainingTime AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPaused AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 取消倒计时
*/ AST#method_declaration#Left cancel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPaused AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 获取剩余时间
* @returns 剩余时间(毫秒)
*/ AST#method_declaration#Left getRemainingTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainingTime AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 重置倒计时
* @param totalTime 新的总时间(毫秒),不填则使用初始总时间
*/ AST#method_declaration#Left reset AST#parameter_list#Left ( AST#parameter#Left totalTime ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left totalTime AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalTime AST#member_expression#Right = AST#expression#Left totalTime AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainingTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPaused AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CountDownTimer {
private totalTime: number;
private interval: number = 1000;
private remainingTime: number;
private timerId: number | null = null;
private isPaused: boolean = false;
private onTickCallback?: (millisUntilFinished: number) => void;
private onFinishCallback?: () => void;
constructor(totalTime: number, interval: number = 1000) {
this.totalTime = totalTime;
this.interval = interval;
this.remainingTime = totalTime;
}
onTick(callback: (millisUntilFinished: number) => void): CountDownTimer {
this.onTickCallback = callback;
return this;
}
onFinish(callback: () => void): CountDownTimer {
this.onFinishCallback = callback;
return this;
}
start(): void {
this.cancel();
this.isPaused = false;
this.remainingTime = this.totalTime;
this.onTickCallback?.(this.remainingTime);
this.timerId = setInterval(() => {
if (this.isPaused) return;
this.remainingTime -= this.interval;
if (this.remainingTime <= 0) {
this.onTickCallback?.(0);
this.onFinishCallback?.();
this.cancel();
} else {
this.onTickCallback?.(this.remainingTime);
}
}, this.interval);
}
pause(): void {
this.isPaused = true;
}
resume(): void {
if (this.isPaused && this.remainingTime > 0) {
this.isPaused = false;
}
}
cancel(): void {
if (this.timerId) {
clearInterval(this.timerId);
this.timerId = null;
}
this.isPaused = false;
}
getRemainingTime(): number {
return this.remainingTime;
}
reset(totalTime?: number): void {
if (totalTime) {
this.totalTime = totalTime;
}
this.remainingTime = this.totalTime;
this.isPaused = false;
}
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/CountDownTimer.ets#L5-L136
|
de67fa8358bf8d34bf4bd8ec24b7d2311a2f3cf7
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
HDRVivid/AVRecorder/entry/src/main/ets/pages/Record.ets
|
arkts
|
stopRecord
|
[End start_record]
|
async stopRecord() {
if (this.avRecorder) {
try {
if (this.videoOutput) {
this.videoOutput.stop((err: BusinessError) => {
if (err) {
Logger.error(TAG, `Failed to stop the video output. error: ${JSON.stringify(err)}`);
return;
}
Logger.info(TAG, 'Callback invoked to indicate the video output stop success.');
});
}
try {
await this.avRecorder.stop();
await this.avRecorder.release();
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `avRecorder stop error: ${JSON.stringify(err)}`);
}
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `avRecorder stop error: ${JSON.stringify(err)}`);
}
if (this.captureSession) {
this.captureSession.stop()
.catch((err: BusinessError) => {
Logger.error(`avRecorder stop failed, code=${err.code}, message=${err.message}`)
})
}
if (this.cameraInput) {
this.cameraInput.close()
.catch((err: BusinessError) => {
Logger.error(`avRecorder close failed, code=${err.code}, message=${err.message}`)
})
}
if (this.previewOutput) {
this.previewOutput.release()
.catch((err: BusinessError) => {
Logger.error(`avRecorder release failed, code=${err.code}, message=${err.message}`)
})
}
if (this.videoOutput) {
this.videoOutput.release()
.catch((err: BusinessError) => {
Logger.error(`avRecorder release failed, code=${err.code}, message=${err.message}`)
})
}
if (this.captureSession) {
this.captureSession.release()
.catch((err: BusinessError) => {
Logger.error(`avRecorder release failed, code=${err.code}, message=${err.message}`)
})
}
if (this.captureSession) {
this.captureSession = undefined;
}
}
}
|
AST#method_declaration#Left async stopRecord AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avRecorder AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoOutput AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoOutput AST#member_expression#Right AST#expression#Right . stop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to stop the video output. error: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Callback invoked to indicate the video output stop success.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . avRecorder AST#member_expression#Right AST#expression#Right . stop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . avRecorder AST#member_expression#Right AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` avRecorder stop error: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` avRecorder stop error: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . captureSession AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . captureSession AST#member_expression#Right AST#expression#Right . stop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` avRecorder stop failed, code= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cameraInput AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cameraInput AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` avRecorder close failed, code= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . previewOutput AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . previewOutput AST#member_expression#Right AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` avRecorder release failed, code= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoOutput AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoOutput AST#member_expression#Right AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` avRecorder release failed, code= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . captureSession AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . captureSession AST#member_expression#Right AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left 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_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` avRecorder release failed, code= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . captureSession AST#member_expression#Right AST#expression#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 . captureSession AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async stopRecord() {
if (this.avRecorder) {
try {
if (this.videoOutput) {
this.videoOutput.stop((err: BusinessError) => {
if (err) {
Logger.error(TAG, `Failed to stop the video output. error: ${JSON.stringify(err)}`);
return;
}
Logger.info(TAG, 'Callback invoked to indicate the video output stop success.');
});
}
try {
await this.avRecorder.stop();
await this.avRecorder.release();
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `avRecorder stop error: ${JSON.stringify(err)}`);
}
} catch (error) {
let err = error as BusinessError;
Logger.error(TAG, `avRecorder stop error: ${JSON.stringify(err)}`);
}
if (this.captureSession) {
this.captureSession.stop()
.catch((err: BusinessError) => {
Logger.error(`avRecorder stop failed, code=${err.code}, message=${err.message}`)
})
}
if (this.cameraInput) {
this.cameraInput.close()
.catch((err: BusinessError) => {
Logger.error(`avRecorder close failed, code=${err.code}, message=${err.message}`)
})
}
if (this.previewOutput) {
this.previewOutput.release()
.catch((err: BusinessError) => {
Logger.error(`avRecorder release failed, code=${err.code}, message=${err.message}`)
})
}
if (this.videoOutput) {
this.videoOutput.release()
.catch((err: BusinessError) => {
Logger.error(`avRecorder release failed, code=${err.code}, message=${err.message}`)
})
}
if (this.captureSession) {
this.captureSession.release()
.catch((err: BusinessError) => {
Logger.error(`avRecorder release failed, code=${err.code}, message=${err.message}`)
})
}
if (this.captureSession) {
this.captureSession = undefined;
}
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVRecorder/entry/src/main/ets/pages/Record.ets#L455-L512
|
94213e307fadde56256dfb2c3efad34940f14111
|
gitee
|
wuyukobe24/HMApp_ArkTS.git
|
6d09d9b07a4fdc4713e5a13b61b85bc1e7893956
|
entry/src/main/ets/pages/home/ViewModel/QQHomeViewModel.ets
|
arkts
|
loadHomeRequestInfoListData
|
请求首页资讯列表数据
|
loadHomeRequestInfoListData(success:(str:string)=>void, fail:(error:NetError)=>void) {
let param:Record<string, string> = {
"main_feeds":"1",
"plat":"iOS",
"ip":"0.0.0.0",
"network":"wifi",
"favzone":"",
"zone":"plat",
"channel":"1",
"transport":"docids%3D6004640787272757818%252C1642662437979068205%26end_index%3D2",
"disableAlgo":"1",
"pic_size":"384x204",
"waterflow":"$WaterFlow$",
"subChannel":"1",
"slidetype":"0",
"next":"0",
}
// https://mlol.qt.qq.com/go/mlol_news/recommend_feeds?main_feeds=1&plat=iOS&ip=0.0.0.0&network=wifi&favzone=&zone=plat&channel=1&transport=docids%3D6004640787272757818%252C1642662437979068205%26end_index%3D2&disableAlgo=1&pic_size=384x204&waterflow=$WaterFlow$&subChannel=1&slidetype=0&next=0
let url:string = '/go/mlol_news/recommend_feeds'
getRequest(url, param, (jsonStr:string) => {
success(jsonStr)
}, (error:NetError) => {
console.error(`viewmodel Segment error:${JSON.stringify(error)}`)
fail(error)
})
}
|
AST#method_declaration#Left loadHomeRequestInfoListData AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fail : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left NetError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left param : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "main_feeds" AST#property_name#Right : AST#expression#Left "1" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "plat" AST#property_name#Right : AST#expression#Left "iOS" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "ip" AST#property_name#Right : AST#expression#Left "0.0.0.0" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "network" AST#property_name#Right : AST#expression#Left "wifi" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "favzone" AST#property_name#Right : AST#expression#Left "" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "zone" AST#property_name#Right : AST#expression#Left "plat" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "channel" AST#property_name#Right : AST#expression#Left "1" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "transport" AST#property_name#Right : AST#expression#Left "docids%3D6004640787272757818%252C1642662437979068205%26end_index%3D2" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "disableAlgo" AST#property_name#Right : AST#expression#Left "1" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "pic_size" AST#property_name#Right : AST#expression#Left "384x204" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "waterflow" AST#property_name#Right : AST#expression#Left "$WaterFlow$" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "subChannel" AST#property_name#Right : AST#expression#Left "1" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "slidetype" AST#property_name#Right : AST#expression#Left "0" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "next" AST#property_name#Right : AST#expression#Left "0" AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right // https://mlol.qt.qq.com/go/mlol_news/recommend_feeds?main_feeds=1&plat=iOS&ip=0.0.0.0&network=wifi&favzone=&zone=plat&channel=1&transport=docids%3D6004640787272757818%252C1642662437979068205%26end_index%3D2&disableAlgo=1&pic_size=384x204&waterflow=$WaterFlow$&subChannel=1&slidetype=0&next=0 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left '/go/mlol_news/recommend_feeds' AST#expression#Right AST#ERROR#Left getRequest AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left param AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left jsonStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left success AST#expression#Right AST#argument_list#Left ( AST#expression#Left jsonStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left NetError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` viewmodel Segment error: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left fail AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
loadHomeRequestInfoListData(success:(str:string)=>void, fail:(error:NetError)=>void) {
let param:Record<string, string> = {
"main_feeds":"1",
"plat":"iOS",
"ip":"0.0.0.0",
"network":"wifi",
"favzone":"",
"zone":"plat",
"channel":"1",
"transport":"docids%3D6004640787272757818%252C1642662437979068205%26end_index%3D2",
"disableAlgo":"1",
"pic_size":"384x204",
"waterflow":"$WaterFlow$",
"subChannel":"1",
"slidetype":"0",
"next":"0",
}
let url:string = '/go/mlol_news/recommend_feeds'
getRequest(url, param, (jsonStr:string) => {
success(jsonStr)
}, (error:NetError) => {
console.error(`viewmodel Segment error:${JSON.stringify(error)}`)
fail(error)
})
}
|
https://github.com/wuyukobe24/HMApp_ArkTS.git/blob/6d09d9b07a4fdc4713e5a13b61b85bc1e7893956/entry/src/main/ets/pages/home/ViewModel/QQHomeViewModel.ets#L84-L109
|
2ea502089fc9172930a8a1840e81937ae421b2da
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
|
arkts
|
getPreferences
|
获取Preferences实例
@param name
@returns
|
private static async getPreferences(preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<preferences.Preferences> {
if (preferenceName !== PreferencesUtil.defaultPreferenceName) {
return await dataPreferences.getPreferences(AppUtil.getContext(), preferenceName);
} else if (!PreferencesUtil.preferences) {
PreferencesUtil.preferences = await dataPreferences.getPreferences(AppUtil.getContext(), preferenceName);
}
return PreferencesUtil.preferences;
}
|
AST#method_declaration#Left private static async getPreferences AST#parameter_list#Left ( AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . defaultPreferenceName AST#member_expression#Right AST#expression#Right AST#parameter#Right ) 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 preferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left preferenceName AST#expression#Right !== AST#expression#Left PreferencesUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaultPreferenceName AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left preferenceName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left PreferencesUtil AST#expression#Right AST#unary_expression#Right AST#expression#Right . preferences AST#member_expression#Right AST#expression#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 PreferencesUtil AST#expression#Right . preferences AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left preferenceName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static async getPreferences(preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<preferences.Preferences> {
if (preferenceName !== PreferencesUtil.defaultPreferenceName) {
return await dataPreferences.getPreferences(AppUtil.getContext(), preferenceName);
} else if (!PreferencesUtil.preferences) {
PreferencesUtil.preferences = await dataPreferences.getPreferences(AppUtil.getContext(), preferenceName);
}
return PreferencesUtil.preferences;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L64-L71
|
e3f0e28425a5a3ec8aa45872caa62fa6f5c2612b
|
gitee
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/common/MyUtils.ets
|
arkts
|
getComponentRect
|
获取组件所占矩形区域坐标
|
static getComponentRect(key: string): RectValue {
let strJson: string = getInspectorByKey(key);
let rectInfo: Array<string> = JSON.parse('[' + JSON.parse(strJson).$rect + ']');
Utils.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0];
Utils.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1];
Utils.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0];
Utils.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1];
return Utils.rect_value = {
left: Utils.rect_left, top: Utils.rect_top, right: Utils.rect_right, bottom: Utils.rect_bottom
}
}
|
AST#method_declaration#Left static getComponentRect 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 RectValue AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left strJson : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getInspectorByKey AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rectInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strJson AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . $rect AST#member_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_left AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_top AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_right AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_bottom AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left rectInfo AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_value AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_left AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_top AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_right AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . rect_bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getComponentRect(key: string): RectValue {
let strJson: string = getInspectorByKey(key);
let rectInfo: Array<string> = JSON.parse('[' + JSON.parse(strJson).$rect + ']');
Utils.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0];
Utils.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1];
Utils.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0];
Utils.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1];
return Utils.rect_value = {
left: Utils.rect_left, top: Utils.rect_top, right: Utils.rect_right, bottom: Utils.rect_bottom
}
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_nowear_api11/entry/src/main/ets/MainAbility/common/MyUtils.ets#L50-L60
|
b5a737a824533b747299d32fd3da487c36e9dbb9
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/components/YAxis.ets
|
arkts
|
calculate
|
@Override
|
public calculate(dataMin: number, dataMax: number): void {
let min: number = dataMin;
let max: number = dataMax;
// Make sure max is greater than min
if (min > max) {
if (this.mCustomAxisMax && this.mCustomAxisMin) {
let t: number = min;
min = max;
max = t;
}
else if (this.mCustomAxisMax) {
min = max < 0 ? max * 1.5 : max * 0.5;
}
else if (this.mCustomAxisMin) {
max = min < 0 ? min * 0.5 : min * 1.5;
}
}
let range: number = Math.abs(max - min);
// in case all values are equal
if (range == 0) {
max = max + 1;
min = min - 1;
}
// recalculate
range = Math.abs(max - min);
// calc extra spacing
this.mAxisMinimum = this.mCustomAxisMin ? this.mAxisMinimum : min - (range / 100) * this.getSpaceBottom();
this.mAxisMaximum = this.mCustomAxisMax ? this.mAxisMaximum : max + (range / 100) * this.getSpaceTop();
this.mAxisRange = Math.abs(this.mAxisMinimum - this.mAxisMaximum);
}
|
AST#method_declaration#Left public calculate AST#parameter_list#Left ( AST#parameter#Left dataMin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataMax : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left dataMin AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left dataMax AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Make sure max is greater than min AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right > AST#expression#Left max AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCustomAxisMax AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mCustomAxisMin AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left min AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left min = AST#expression#Left max AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left max = AST#expression#Left t AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCustomAxisMax AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left min = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right * AST#expression#Left 1.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right * AST#expression#Left 0.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCustomAxisMin AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left max = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right * AST#expression#Left 0.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right * AST#expression#Left 1.5 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left range : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right - AST#expression#Left min AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // in case all values are equal AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left range AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left max = AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left min = AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // recalculate AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left range = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right - AST#expression#Left min AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // calc extra spacing 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 . mAxisMinimum AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCustomAxisMin AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left range AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right . getSpaceBottom AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . mAxisMaximum AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCustomAxisMax AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left range AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right . getSpaceTop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . mAxisRange AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public calculate(dataMin: number, dataMax: number): void {
let min: number = dataMin;
let max: number = dataMax;
if (min > max) {
if (this.mCustomAxisMax && this.mCustomAxisMin) {
let t: number = min;
min = max;
max = t;
}
else if (this.mCustomAxisMax) {
min = max < 0 ? max * 1.5 : max * 0.5;
}
else if (this.mCustomAxisMin) {
max = min < 0 ? min * 0.5 : min * 1.5;
}
}
let range: number = Math.abs(max - min);
if (range == 0) {
max = max + 1;
min = min - 1;
}
range = Math.abs(max - min);
this.mAxisMinimum = this.mCustomAxisMin ? this.mAxisMinimum : min - (range / 100) * this.getSpaceBottom();
this.mAxisMaximum = this.mCustomAxisMax ? this.mAxisMaximum : max + (range / 100) * this.getSpaceTop();
this.mAxisRange = Math.abs(this.mAxisMinimum - this.mAxisMaximum);
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L493-L529
|
b77bffcc0f540f24136a644558230284f52fb245
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/auth/src/main/ets/view/LoginPage.ets
|
arkts
|
LoginContent
|
登录页内容视图
@returns {void} 无返回值
|
@Builder
private LoginContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
IBestButton({
text: $r("app.string.login_action"),
type: "primary",
buttonSize: "large",
round: true,
btnWidth: P100,
loading: this.vm.isLoginLoading,
disabled: this.vm.isLoginLoading,
onBtnClick: (): void => {
this.vm.login();
}
});
};
};
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private LoginContent 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 MediumPaddingVerticalScroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left IBestButton ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.login_action" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left "primary" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonSize : AST#expression#Left "large" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left round : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left btnWidth : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left loading : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . isLoginLoading AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left disabled : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . isLoginLoading AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onBtnClick : AST#expression#Left AST#arrow_function#Left 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . login AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private LoginContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
IBestButton({
text: $r("app.string.login_action"),
type: "primary",
buttonSize: "large",
round: true,
btnWidth: P100,
loading: this.vm.isLoginLoading,
disabled: this.vm.isLoginLoading,
onBtnClick: (): void => {
this.vm.login();
}
});
};
};
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/auth/src/main/ets/view/LoginPage.ets#L35-L53
|
5af20f5b299e107fe6247a1ab434766bf4b351c1
|
github
|
dcm23333/FishManager.git
|
952dde4475268ac16f3480f3d55f82033aa6b467
|
FishManager/entry/src/main/ets/common/contants/commonContants.ets
|
arkts
|
THOUSANDTH
|
export const THOUSANDTH_15: string = '1.5%';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_15 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '1.5%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const THOUSANDTH_15: string = '1.5%';
|
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L46-L46
|
ed2306a024aa4f5c1f65a1f036c55c50ac802e38
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/DateUtils.ets
|
arkts
|
toDateString
|
格式化为日期字符串[YYYY-MM-DD]
@param date 要格式化的日期对象
@returns "YYYY-MM-DD"格式的日期字符串
|
static toDateString(date: Date): string {
return DateUtils.formatDate(date, 'YYYY-MM-DD');
}
|
AST#method_declaration#Left static toDateString AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . formatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right , AST#expression#Left 'YYYY-MM-DD' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static toDateString(date: Date): string {
return DateUtils.formatDate(date, 'YYYY-MM-DD');
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L138-L140
|
6f8223135bdf30469724e2790bcbc9dc5b027687
|
github
|
njkndxz/learn-ArkTs.git
|
70fabab8ee28e3637329d53a4ec93afc72a001c2
|
entry/src/main/ets/entryability/EntryAbility.ets
|
arkts
|
onWindowStageDestroy
|
当窗口舞台销毁时
|
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#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'Ability onWindowStageDestroy' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
onWindowStageDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
|
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/entryability/EntryAbility.ets#L45-L48
|
87b7a88977406f40789aa1c253ee8a9b9f3b4eb4
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/toolbox/src/main/ets/model/CustomTool.ets
|
arkts
|
自定义工具项
|
export class CustomTool {
// 工具项UI
private builder_: WrappedBuilder<[ToolInterface]>;
// 工具项相对于悬浮球中心的偏移
private offset_: Offset;
// 悬浮球位于角落时工具项相对于悬浮球中心的偏移
private cornerOffset_: Offset;
// 工具项属性集
private attributeSet_?: AttributeSet;
constructor(builder: WrappedBuilder<[ToolInterface]>, offset: Offset, cornerOffset: Offset,attributeSet?: AttributeSet) {
this.builder_ = builder;
this.offset_ = offset;
this.cornerOffset_ = cornerOffset;
this.attributeSet_ = attributeSet;
}
get builder(): WrappedBuilder<[ToolInterface]> {
return this.builder_;
}
get offset(): Offset {
return this.offset_;
}
get cornerOffset(): Offset {
return this.cornerOffset_;
}
get attributeSet(): AttributeSet | undefined {
return this.attributeSet_;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class CustomTool AST#class_body#Left { // 工具项UI AST#property_declaration#Left private builder_ : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left ToolInterface AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 工具项相对于悬浮球中心的偏移 AST#property_declaration#Left private offset_ : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 悬浮球位于角落时工具项相对于悬浮球中心的偏移 AST#property_declaration#Left private cornerOffset_ : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 工具项属性集 AST#property_declaration#Left private attributeSet_ ? : AST#type_annotation#Left AST#primary_type#Left AttributeSet AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left ToolInterface AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cornerOffset : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attributeSet ? : AST#type_annotation#Left AST#primary_type#Left AttributeSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) 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 . builder_ AST#member_expression#Right = AST#expression#Left builder AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . offset_ AST#member_expression#Right = AST#expression#Left offset AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . cornerOffset_ AST#member_expression#Right = AST#expression#Left cornerOffset AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . attributeSet_ AST#member_expression#Right = AST#expression#Left attributeSet AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left get AST#ERROR#Left build er AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left ToolInterface AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builder_ AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left get AST#ERROR#Left of fset AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offset_ AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left get AST#ERROR#Left cornerOffset AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cornerOffset_ AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left get AST#ERROR#Left attributeSet AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AttributeSet AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . attributeSet_ AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class CustomTool {
private builder_: WrappedBuilder<[ToolInterface]>;
private offset_: Offset;
private cornerOffset_: Offset;
private attributeSet_?: AttributeSet;
constructor(builder: WrappedBuilder<[ToolInterface]>, offset: Offset, cornerOffset: Offset,attributeSet?: AttributeSet) {
this.builder_ = builder;
this.offset_ = offset;
this.cornerOffset_ = cornerOffset;
this.attributeSet_ = attributeSet;
}
get builder(): WrappedBuilder<[ToolInterface]> {
return this.builder_;
}
get offset(): Offset {
return this.offset_;
}
get cornerOffset(): Offset {
return this.cornerOffset_;
}
get attributeSet(): AttributeSet | undefined {
return this.attributeSet_;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/model/CustomTool.ets#L23-L55
|
7f64420f3c81b3e49a508f3a6b9b39f888425f56
|
gitee
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
|
arkts
|
getYOffset
|
Returns the used offset on the x-axis for drawing the axis labels. This
offset is applied before and after the label.
@return
|
public getYOffset(): number {
return this.mYOffset;
}
|
AST#method_declaration#Left public getYOffset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mYOffset AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getYOffset(): number {
return this.mYOffset;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L80-L82
|
8b2deb81037e4e2079dbbf4f390d96f2b37b94f2
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/base/PickerUtil.ets
|
arkts
|
initSuffixList
|
初始化内置的文件选择后缀
@returns
|
private static initSuffixList(): Array<string> {
let suffixList = new Array<string>();
suffixList.push('.doc');
suffixList.push('.docx');
suffixList.push('.pdf');
suffixList.push('.ppt');
suffixList.push('.pptx');
suffixList.push('.txt');
suffixList.push('.wps');
suffixList.push('.xls');
suffixList.push('.xlsx');
return suffixList;
}
|
AST#method_declaration#Left private static initSuffixList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left suffixList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.doc' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.docx' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.pdf' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.ppt' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.pptx' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.txt' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.wps' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.xls' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left suffixList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.xlsx' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left suffixList AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static initSuffixList(): Array<string> {
let suffixList = new Array<string>();
suffixList.push('.doc');
suffixList.push('.docx');
suffixList.push('.pdf');
suffixList.push('.ppt');
suffixList.push('.pptx');
suffixList.push('.txt');
suffixList.push('.wps');
suffixList.push('.xls');
suffixList.push('.xlsx');
return suffixList;
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PickerUtil.ets#L36-L48
|
12b636b7ec36ed089a281375b5f8046de9586be0
|
gitee
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets
|
arkts
|
decryptECB
|
解密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@returns
|
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, null, '3DES192|ECB|PKCS7');
}
|
AST#method_declaration#Left static async decryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DES AST#expression#Right . decrypt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right , AST#expression#Left '3DES192|ECB|PKCS7' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async decryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> {
return DES.decrypt(data, symKey, null, '3DES192|ECB|PKCS7');
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets#L53-L55
|
532e7976f814b8f50a0eb7f40aa209183fcdd58e
|
github
|
XiangRui_FuZi/harmony-oscourse
|
da885f9a777a1eace7a07e1cd81137746687974b
|
class1/entry/src/main/ets/commons/network/HttpUtils.ets
|
arkts
|
postHttpRequest
|
The method of initiating a POST request through HTTP.
|
async postHttpRequest(): Promise<ListInfo[]> {
let responseData: Array<ListInfo> = [];
await this.httpRequest.request(RESOURCE_URL,
{
method: http.RequestMethod.POST, extraData: {
'status': '1',
'belong': '1',
'language': 'cn',
'needTop': 1,
'displayChannel': [1, 3],
'count': 4,
'pagestart': 1,
'type': '1,4,5,6'
},
header: new Header('application/json;charset=UTF-8')
}).then((data: http.HttpResponse) => {
let result: ResponseData = JSON.parse(data.result as string);
responseData = result.value.list;
}).catch((err: Error) => {
hilog.info(0x0000, TAG, JSON.stringify(err));
});
return responseData;
}
|
AST#method_declaration#Left async postHttpRequest 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#array_type#Left ListInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left responseData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ListInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . httpRequest AST#member_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left RESOURCE_URL AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'status' AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'belong' AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'language' AST#property_name#Right : AST#expression#Left 'cn' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'needTop' AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'displayChannel' AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'count' AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'pagestart' AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'type' AST#property_name#Right : AST#expression#Left '1,4,5,6' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Header AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'application/json;charset=UTF-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left ResponseData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left responseData = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . value AST#member_expression#Right AST#expression#Right . list AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left responseData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async postHttpRequest(): Promise<ListInfo[]> {
let responseData: Array<ListInfo> = [];
await this.httpRequest.request(RESOURCE_URL,
{
method: http.RequestMethod.POST, extraData: {
'status': '1',
'belong': '1',
'language': 'cn',
'needTop': 1,
'displayChannel': [1, 3],
'count': 4,
'pagestart': 1,
'type': '1,4,5,6'
},
header: new Header('application/json;charset=UTF-8')
}).then((data: http.HttpResponse) => {
let result: ResponseData = JSON.parse(data.result as string);
responseData = result.value.list;
}).catch((err: Error) => {
hilog.info(0x0000, TAG, JSON.stringify(err));
});
return responseData;
}
|
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/network/HttpUtils.ets#L55-L77
|
0efb2bead03d9f11e1f20236c1f7da99e8ecced7
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets
|
arkts
|
BreakpointCard
|
当前断点信息
@returns {void} 无返回值
|
@Builder
private BreakpointCard(): void {
Column() {
this.CardTitle($r("app.string.demo_screen_adapt_breakpoint_label"));
SpaceVerticalSmall();
this.CardDesc(this.breakpointState.current);
}
.width(P100)
.padding($r("app.float.space_padding_medium"))
.backgroundColor($r("app.color.bg_white"))
.borderRadius($r("app.float.radius_medium"));
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private BreakpointCard 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_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_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 . CardTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_screen_adapt_breakpoint_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; AST#ui_custom_component_statement#Right 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 . CardDesc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . breakpointState AST#member_expression#Right AST#expression#Right . current AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private BreakpointCard(): void {
Column() {
this.CardTitle($r("app.string.demo_screen_adapt_breakpoint_label"));
SpaceVerticalSmall();
this.CardDesc(this.breakpointState.current);
}
.width(P100)
.padding($r("app.float.space_padding_medium"))
.backgroundColor($r("app.color.bg_white"))
.borderRadius($r("app.float.radius_medium"));
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L184-L195
|
84a64fd27f9edbadc44db94f5f585eec1d97ac03
|
github
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/datatype/primitives/primitives_number_002_F.ets
|
arkts
|
Introduction 基础数据类型-number
|
export function primitives_number_002_F(taint_src : number) : void {
let _t : number = taint_src;
let _clean = 1;
taint.Sink(_clean);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function primitives_number_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left _t : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left taint_src AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left _clean = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left _clean AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function primitives_number_002_F(taint_src : number) : void {
let _t : number = taint_src;
let _clean = 1;
taint.Sink(_clean);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/datatype/primitives/primitives_number_002_F.ets#L6-L10
|
3376bca20f12faf97576f4cf5e32b1f38972c16f
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Row.ets
|
arkts
|
渲染布局
@returns {void} 无返回值
@example
RowStartBottom() { Text("Hi"); }
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Start,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
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#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Start,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L924-L939
|
85fc394286a2457cb685cd6f617f087b66f9eca7
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
|
arkts
|
generateSymKeySync
|
生成对称密钥SymKey,同步
@param algName 待生成对称密钥生成器的算法名称(AES128、AES192、AES256、3DES192、SM4_128、HMAC、HMAC|SHA1、HMAC|SHA256、HMAC|SHA512、HMAC|SM3、等)
@returns
|
static generateSymKeySync(algName: string): cryptoFramework.SymKey {
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(algName); //创建对称密钥生成器
let symKey = symKeyGenerator.generateSymKeySync(); //获取该对称密钥生成器随机生成的密钥
return symKey;
}
|
AST#method_declaration#Left static generateSymKeySync AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createSymKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //创建对称密钥生成器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left symKeyGenerator AST#expression#Right . generateSymKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //获取该对称密钥生成器随机生成的密钥 AST#statement#Left AST#return_statement#Left return AST#expression#Left symKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static generateSymKeySync(algName: string): cryptoFramework.SymKey {
let symKeyGenerator = cryptoFramework.createSymKeyGenerator(algName);
let symKey = symKeyGenerator.generateSymKeySync();
return symKey;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L111-L115
|
e537118a30afe284d44fc23988031b29b3185346
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/constants/MsgType.ets
|
arkts
|
聊天消息类型常量定义。
特别注意:本类中定义的常量切勿重复,否则将影响聊天列表UI的正常展现!
|
export default class MsgType {
/** 聊天消息类型之:普通文字消息 */
static readonly TYPE_TEXT: number = 0;
/** 聊天消息类型之:图片消息(即消息内容就是存放于服务端的磁盘图片文件名) */
static readonly TYPE_IMAGE: number = 1;
/** 聊天消息类型之:语音留言消息(即消息内容就是存放于服务端的语音留言文件名) */
static readonly TYPE_VOICE: number = 2;
/** 聊天消息类型之:系统消息或提示信息(此类消息通常由服务器即f="0"的用户发出). */
static readonly TYPE_SYSTEAM$INFO: number = 90;
static readonly VOD_MOMENT_TIME: string = "vod_moment";
static readonly VOD_SUBTITLE_TIME: string = "subtitle_time";
static readonly LOTTERY_MSG: string = "LotteryDialog_msg";
static readonly SIGN_CONDITION: string = "lottery_sign_condition";
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class MsgType AST#class_body#Left { /** 聊天消息类型之:普通文字消息 */ AST#property_declaration#Left static readonly TYPE_TEXT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /** 聊天消息类型之:图片消息(即消息内容就是存放于服务端的磁盘图片文件名) */ AST#property_declaration#Left static readonly TYPE_IMAGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** 聊天消息类型之:语音留言消息(即消息内容就是存放于服务端的语音留言文件名) */ AST#property_declaration#Left static readonly TYPE_VOICE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /** 聊天消息类型之:系统消息或提示信息(此类消息通常由服务器即f="0"的用户发出). */ AST#property_declaration#Left static readonly TYPE_SYSTEAM$INFO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 90 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly VOD_MOMENT_TIME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "vod_moment" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly VOD_SUBTITLE_TIME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "subtitle_time" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly LOTTERY_MSG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "LotteryDialog_msg" AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly SIGN_CONDITION : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "lottery_sign_condition" AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class MsgType {
static readonly TYPE_TEXT: number = 0;
static readonly TYPE_IMAGE: number = 1;
static readonly TYPE_VOICE: number = 2;
static readonly TYPE_SYSTEAM$INFO: number = 90;
static readonly VOD_MOMENT_TIME: string = "vod_moment";
static readonly VOD_SUBTITLE_TIME: string = "subtitle_time";
static readonly LOTTERY_MSG: string = "LotteryDialog_msg";
static readonly SIGN_CONDITION: string = "lottery_sign_condition";
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/constants/MsgType.ets#L6-L22
|
7d7e22f358b3829ec7b7460da4c72f497338378f
|
gitee
|
|
Delsin-Yu/JustPDF.git
|
d53f566e02820dac46e1752151750144acbed50a
|
entry/src/main/ets/components/PageInfo.ets
|
arkts
|
prefetchPagesAround
|
Prefetches pages around the center index and evicts caches for distant pages.
@param centerIndex The current page index being viewed
@param prefetchRange Number of pages to prefetch on each side (default: 3)
@param evictionRange Pages beyond this range will have their viewer caches evicted (default: 5)
|
public prefetchPagesAround(
centerIndex: number,
prefetchRange: number = 3,
evictionRange: number = 5
): void {
const totalPages = this.totalPageCount();
// Prefetch pages within range
for (let offset = -prefetchRange; offset <= prefetchRange; offset++) {
const pageIndex = centerIndex + offset;
if (pageIndex < 0 || pageIndex >= totalPages) continue;
// Determine priority: HIGH for center, MEDIUM for adjacent
const priority = offset === 0
? taskpool.Priority.HIGH
: taskpool.Priority.MEDIUM;
try {
const result = this.getPageInfo(pageIndex);
result[1].ensureCached(MIN_RENDER_SCALE, priority);
} catch (error) {
hilog.debug(0, 'PDFView', `预取页面 ${pageIndex} 时出错: ${error}`);
}
}
// Evict viewer caches for pages outside eviction range
// Note: Thumbnails are managed separately via releaseThumbnail() in PageManagerDialog
let pageCounter = 0;
for (const group of this.pageGroups) {
for (const pageInfo of group.pages) {
const globalIndex = pageCounter;
const distance = Math.abs(globalIndex - centerIndex);
if (distance > evictionRange) {
pageInfo.evictViewerCache();
}
pageCounter++;
}
}
hilog.info(0, 'PDFView', `预取页面 ${centerIndex} 周围 ±${prefetchRange},清除 ±${evictionRange} 外的缓存`);
}
|
AST#method_declaration#Left public prefetchPagesAround AST#parameter_list#Left ( AST#parameter#Left centerIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left prefetchRange : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right AST#parameter#Right , AST#parameter#Left evictionRange : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right AST#parameter#Right ) 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 totalPages = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalPageCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Prefetch pages within range AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left offset = AST#expression#Left AST#unary_expression#Left - AST#expression#Left prefetchRange AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left offset AST#expression#Right <= AST#expression#Left prefetchRange AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left offset AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pageIndex = AST#expression#Left AST#binary_expression#Left AST#expression#Left centerIndex AST#expression#Right + AST#expression#Left offset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left pageIndex AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left pageIndex AST#expression#Right >= AST#expression#Left totalPages AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#continue_statement#Left continue ; AST#continue_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // Determine priority: HIGH for center, MEDIUM for adjacent AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left priority = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left offset AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taskpool AST#expression#Right . Priority AST#member_expression#Right AST#expression#Right . HIGH AST#member_expression#Right AST#expression#Right : AST#expression#Left taskpool AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Priority AST#member_expression#Right AST#expression#Right . MEDIUM AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getPageInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pageIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . ensureCached AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MIN_RENDER_SCALE AST#expression#Right , AST#expression#Left priority AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 'PDFView' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 预取页面 AST#template_substitution#Left $ { AST#expression#Left pageIndex AST#expression#Right } AST#template_substitution#Right 时出错: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // Evict viewer caches for pages outside eviction range // Note: Thumbnails are managed separately via releaseThumbnail() in PageManagerDialog AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pageCounter = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const group of AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageGroups AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const pageInfo of AST#expression#Left AST#member_expression#Left AST#expression#Left group AST#expression#Right . pages AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left globalIndex = AST#expression#Left pageCounter AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left distance = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left globalIndex AST#expression#Right - AST#expression#Left centerIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left distance AST#expression#Right > AST#expression#Left evictionRange AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pageInfo AST#expression#Right . evictViewerCache AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left pageCounter AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 'PDFView' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 预取页面 AST#template_substitution#Left $ { AST#expression#Left centerIndex AST#expression#Right } AST#template_substitution#Right 周围 ± AST#template_substitution#Left $ { AST#expression#Left prefetchRange AST#expression#Right } AST#template_substitution#Right ,清除 ± AST#template_substitution#Left $ { AST#expression#Left evictionRange AST#expression#Right } AST#template_substitution#Right 外的缓存 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public prefetchPagesAround(
centerIndex: number,
prefetchRange: number = 3,
evictionRange: number = 5
): void {
const totalPages = this.totalPageCount();
for (let offset = -prefetchRange; offset <= prefetchRange; offset++) {
const pageIndex = centerIndex + offset;
if (pageIndex < 0 || pageIndex >= totalPages) continue;
const priority = offset === 0
? taskpool.Priority.HIGH
: taskpool.Priority.MEDIUM;
try {
const result = this.getPageInfo(pageIndex);
result[1].ensureCached(MIN_RENDER_SCALE, priority);
} catch (error) {
hilog.debug(0, 'PDFView', `预取页面 ${pageIndex} 时出错: ${error}`);
}
}
let pageCounter = 0;
for (const group of this.pageGroups) {
for (const pageInfo of group.pages) {
const globalIndex = pageCounter;
const distance = Math.abs(globalIndex - centerIndex);
if (distance > evictionRange) {
pageInfo.evictViewerCache();
}
pageCounter++;
}
}
hilog.info(0, 'PDFView', `预取页面 ${centerIndex} 周围 ±${prefetchRange},清除 ±${evictionRange} 外的缓存`);
}
|
https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L488-L530
|
3ed2fb8f068d51b25a4d1c3f27e099a4719be4d2
|
github
|
Hyricane/Interview_Success.git
|
9783273fe05fc8951b99bf32d3887c605268db8f
|
entry/src/main/ets/models/index.ets
|
arkts
|
单个分类
|
export interface QuestionType {
id: number
name: string
displayNewestFlag: 0 | 1
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface QuestionType AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#ERROR#Left displayNewestFlag : 0 | 1 AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface QuestionType {
id: number
name: string
displayNewestFlag: 0 | 1
}
|
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/models/index.ets#L11-L15
|
087cdac873b9b2669bda1a0ac0885617672000fa
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Performance/PerformanceLibrary/feature/smartPerfEditor/src/main/ets/view/SmartPerfEditorView.ets
|
arkts
|
SmartPerfEditorView
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Component
export struct SmartPerfEditorView {
@State isVisible: Visibility = Visibility.None;
build() {
Column() {
Button($r('app.string.show_hide_image'))
.id('showImageBtn')
.onClick(() => {
if (this.isVisible == Visibility.Visible) {
this.isVisible = Visibility.None
} else {
this.isVisible = Visibility.Visible
}
})
Stack() {
Row().width('40%').height('40%').backgroundColor(Color.Pink)
Text("Hello World").fontSize(40)
Image($r('app.media.editor_image')).width('100%').height('100%')
}.width('100%').height('100%').backgroundColor(Color.Green).visibility(this.isVisible)
}.width('100%')
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SmartPerfEditorView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isVisible : AST#type_annotation#Left AST#primary_type#Left Visibility AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . None AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right 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_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.show_hide_image' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'showImageBtn' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVisible AST#member_expression#Right AST#expression#Right == AST#expression#Left Visibility AST#expression#Right AST#binary_expression#Right AST#expression#Right . Visible AST#member_expression#Right AST#expression#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 . isVisible AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . None AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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 . isVisible AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '40%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '40%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "Hello World" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.editor_image' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isVisible AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct SmartPerfEditorView {
@State isVisible: Visibility = Visibility.None;
build() {
Column() {
Button($r('app.string.show_hide_image'))
.id('showImageBtn')
.onClick(() => {
if (this.isVisible == Visibility.Visible) {
this.isVisible = Visibility.None
} else {
this.isVisible = Visibility.Visible
}
})
Stack() {
Row().width('40%').height('40%').backgroundColor(Color.Pink)
Text("Hello World").fontSize(40)
Image($r('app.media.editor_image')).width('100%').height('100%')
}.width('100%').height('100%').backgroundColor(Color.Green).visibility(this.isVisible)
}.width('100%')
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/smartPerfEditor/src/main/ets/view/SmartPerfEditorView.ets#L16-L38
|
99f7b8f4f534fba954faa4ea56a2d4adbca3b9c7
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.ProgressButtonV2.d.ets
|
arkts
|
Defines ClickCallback of the ProgressButtonV2.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@crossplatform
@since 18
|
export type ClickCallback = () => void;
|
AST#export_declaration#Left export AST#type_declaration#Left type ClickCallback = AST#type_annotation#Left AST#function_type#Left 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#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
|
export type ClickCallback = () => void;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ProgressButtonV2.d.ets#L182-L182
|
097054a9f4f7943dbf3a07e38293ca3c59550aee
|
gitee
|
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/feature/PixelMapQueue.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 law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export default class PixelMapQueue {
private items: PixelMap[];
constructor() {
this.items = [];
}
push(pm: PixelMap): void {
this.items.push(pm);
}
pop(): PixelMap | undefined{
return this.items.pop();
}
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class PixelMapQueue AST#class_body#Left { AST#property_declaration#Left private items : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PixelMap [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor 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 . items AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left push AST#parameter_list#Left ( AST#parameter#Left pm : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . items AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pm AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left pop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . items AST#member_expression#Right AST#expression#Right . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class PixelMapQueue {
private items: PixelMap[];
constructor() {
this.items = [];
}
push(pm: PixelMap): void {
this.items.push(pm);
}
pop(): PixelMap | undefined{
return this.items.pop();
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/feature/PixelMapQueue.ets#L16-L30
|
00b9dfe82e4a5e1059954d2d99a7a6592e4fe4a6
|
gitee
|
|
LiuAnclouds/Harmony-ArkTS-App.git
|
2119ce333927599b81a31081bc913e1416837308
|
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
|
arkts
|
filterCities
|
过滤城市列表
|
private filterCities() {
if (!this.searchText.trim()) {
this.isSearching = false;
this.filteredCities = [];
} else {
this.isSearching = true;
this.filteredCities = this.allCities.filter(city =>
city.city_name.includes(this.searchText.trim())
);
}
}
|
AST#method_declaration#Left private filterCities 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . searchText AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSearching AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filteredCities AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSearching AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filteredCities AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allCities AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left city => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . city_name AST#member_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchText AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private filterCities() {
if (!this.searchText.trim()) {
this.isSearching = false;
this.filteredCities = [];
} else {
this.isSearching = true;
this.filteredCities = this.allCities.filter(city =>
city.city_name.includes(this.searchText.trim())
);
}
}
|
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L214-L224
|
a0d556c0db0c2a5084bc63bb6d8a8e105428d456
|
github
|
openharmony/applications_settings
|
aac607310ec30e30d1d54db2e04d055655f72730
|
product/phone/src/main/ets/pages/bluetooth.ets
|
arkts
|
pairDevice
|
Pair device
@param device
|
pairDevice(device: BluetoothDevice) {
if (this.controller) {
this.controller.pair(device.deviceId);
}
}
|
AST#method_declaration#Left pairDevice AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left BluetoothDevice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . pair AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left device AST#expression#Right . deviceId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
pairDevice(device: BluetoothDevice) {
if (this.controller) {
this.controller.pair(device.deviceId);
}
}
|
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/bluetooth.ets#L606-L610
|
c7010afa1bfd057631341336a3aaf7f7eac5960a
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets
|
arkts
|
savePixelMap
|
保存pixelMap,返回路径
@param pm
@returns
|
async savePixelMap(context: Context, pm: PixelMap): Promise<string> {
if (pm === null) {
logger.error(TAG, 'pm is null');
return '';
}
const imagePackerApi: image.ImagePacker = image.createImagePacker();
let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 30 };
try {
this.packToFile(context, pm);
const data: ArrayBuffer = await imagePackerApi.packing(pm, packOpts);
// PixelMap转为data
this.packToDataPixelMap(context, data)
return await this.saveFile(context, data);
} catch (err) {
logger.error(TAG, 'save file failed,err=' + JSON.stringify(err));
return '';
}
}
|
AST#method_declaration#Left async savePixelMap AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pm : AST#type_annotation#Left AST#primary_type#Left PixelMap 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left pm AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'pm is null' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imagePackerApi : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImagePacker AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImagePacker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left packOpts : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PackingOption AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left format AST#property_name#Right : AST#expression#Left 'image/jpeg' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left quality AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . packToFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left pm AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left imagePackerApi AST#expression#Right AST#await_expression#Right AST#expression#Right . packing AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pm AST#expression#Right , AST#expression#Left packOpts AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // PixelMap转为data AST#statement#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 . packToDataPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . saveFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'save file failed,err=' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async savePixelMap(context: Context, pm: PixelMap): Promise<string> {
if (pm === null) {
logger.error(TAG, 'pm is null');
return '';
}
const imagePackerApi: image.ImagePacker = image.createImagePacker();
let packOpts: image.PackingOption = { format: 'image/jpeg', quality: 30 };
try {
this.packToFile(context, pm);
const data: ArrayBuffer = await imagePackerApi.packing(pm, packOpts);
this.packToDataPixelMap(context, data)
return await this.saveFile(context, data);
} catch (err) {
logger.error(TAG, 'save file failed,err=' + JSON.stringify(err));
return '';
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets#L31-L48
|
8964b49827a51bc0aa291ce2fc43f461f18ea129
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoThumbOption.ets
|
arkts
|
视频帧图片选项
|
export class ThumbContent {
// 当加载帧没有完成,默认的占位图
framePlaceholder?: PixelMap = undefined;
// 裁剪视频预览长方形条状区域背景颜色
frameBackground: string = '#000000';
// 视频帧加载成功后的图片信息
pixelMap?: PixelMap = undefined;
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ThumbContent AST#class_body#Left { // 当加载帧没有完成,默认的占位图 AST#property_declaration#Left framePlaceholder ? : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right // 裁剪视频预览长方形条状区域背景颜色 AST#property_declaration#Left frameBackground : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#000000' AST#expression#Right ; AST#property_declaration#Right // 视频帧加载成功后的图片信息 AST#property_declaration#Left pixelMap ? : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ThumbContent {
framePlaceholder?: PixelMap = undefined;
frameBackground: string = '#000000';
pixelMap?: PixelMap = undefined;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoThumbOption.ets#L19-L26
|
b657755078388b44d6656a55ced8134b73613fa8
|
gitee
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/List/entry/src/main/ets/common/CommonConstants.ets
|
arkts
|
thousandth
|
export const GOODS_LIST_HEIGHT: string = '20%';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GOODS_LIST_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '20%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const GOODS_LIST_HEIGHT: string = '20%';
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L17-L17
|
74749b786a53636b62d8034f99db6088f4174b3c
|
gitee
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/utils/Transformer.ets
|
arkts
|
generateTransformedValuesBubble
|
Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the BUBBLECHART.
@param data
@return
|
public generateTransformedValuesBubble(data: IBubbleDataSet, phaseY: number, from: number, to: number): number[] {
const count = (to - from + 1) * 2; // (int) Math.ceil((to - from) * phaseX) * 2;
if (this.valuePointsForGenerateTransformedValuesBubble.length != count) {
this.valuePointsForGenerateTransformedValuesBubble = new Array<number>(count);
}
let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesBubble;
for (let j = 0; j < count; j += 2) {
let e: Entry | null = data.getEntryForIndex(j / 2 + from);
if (e != null) {
valuePoints[j] = e.getX();
valuePoints[j + 1] = e.getY() * phaseY;
} else {
valuePoints[j] = 0;
valuePoints[j + 1] = 0;
}
}
this.getValueToPixelMatrix().mapPoints(valuePoints);
return valuePoints;
}
|
AST#method_declaration#Left public generateTransformedValuesBubble AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IBubbleDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left count = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left to AST#expression#Right - AST#expression#Left from AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // (int) Math.ceil((to - from) * phaseX) * 2; AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesBubble AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#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 . valuePointsForGenerateTransformedValuesBubble AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left count AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left valuePoints : 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#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesBubble AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left j += AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Entry AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getEntryForIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left from AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left e AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getX AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left phaseY AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getValueToPixelMatrix AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . mapPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left valuePoints AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left valuePoints AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public generateTransformedValuesBubble(data: IBubbleDataSet, phaseY: number, from: number, to: number): number[] {
const count = (to - from + 1) * 2;
if (this.valuePointsForGenerateTransformedValuesBubble.length != count) {
this.valuePointsForGenerateTransformedValuesBubble = new Array<number>(count);
}
let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesBubble;
for (let j = 0; j < count; j += 2) {
let e: Entry | null = data.getEntryForIndex(j / 2 + from);
if (e != null) {
valuePoints[j] = e.getX();
valuePoints[j + 1] = e.getY() * phaseY;
} else {
valuePoints[j] = 0;
valuePoints[j + 1] = 0;
}
}
this.getValueToPixelMatrix().mapPoints(valuePoints);
return valuePoints;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L144-L169
|
16dc26167c2b4c237e13f7c7a1862c1cb66f7a43
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_axios/src/main/ets/axios/AxiosUtil.ets
|
arkts
|
getAxios
|
获取默认的axios对象
@returns AxiosStatic
|
private static getAxios(): AxiosStatic {
const context = axios.create({
baseURL: efAxiosParams.baseURL,
timeout: 10000
});
return context as AxiosStatic;
}
|
AST#method_declaration#Left private static getAxios AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AxiosStatic AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left baseURL AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left efAxiosParams AST#expression#Right . baseURL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left context AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AxiosStatic AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static getAxios(): AxiosStatic {
const context = axios.create({
baseURL: efAxiosParams.baseURL,
timeout: 10000
});
return context as AxiosStatic;
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/AxiosUtil.ets#L42-L48
|
5a23e6a1cb1548dc20f1ca8a1b43f2d28ed6813b
|
gitee
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/core/src/main/ets/utils/ShareUtils.ets
|
arkts
|
shareText
|
分享文本
@param title
@param content
@param description
|
static shareText(
title: string,
content: string,
description: string = '来自--xxxAPP'): Promise<boolean> {
let shareData: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.TEXT,
title: title,
content: content,
description: description,
})
return ShareUtils.systemShare(shareData)
}
|
AST#method_declaration#Left static shareText AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '来自--xxxAPP' AST#expression#Right AST#parameter#Right ) 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left shareData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . SharedData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left systemShare AST#expression#Right AST#new_expression#Right AST#expression#Right . SharedData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left utd AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . UniformDataType AST#member_expression#Right AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left title AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left content AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left description AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ShareUtils AST#expression#Right . systemShare AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left shareData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static shareText(
title: string,
content: string,
description: string = '来自--xxxAPP'): Promise<boolean> {
let shareData: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.TEXT,
title: title,
content: content,
description: description,
})
return ShareUtils.systemShare(shareData)
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ShareUtils.ets#L50-L61
|
51682d60e557e258f68b747a6f6b3b58c1d4f9fb
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/charts/PieChartModel.ets
|
arkts
|
setEntryLabelTextSize
|
Sets the size of the entry labels in vp. Default: 14vp
@param size
|
public setEntryLabelTextSize(size: number): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer).getPaintEntryLabels()
.setTextSize(Utils.handleDataValues(size));
}
|
AST#method_declaration#Left public setEntryLabelTextSize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( /*(PieChartRenderer)*/ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mRenderer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PieChartRenderer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . getPaintEntryLabels AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setTextSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . handleDataValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left size AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setEntryLabelTextSize(size: number): void {
(
this.mRenderer as PieChartRenderer).getPaintEntryLabels()
.setTextSize(Utils.handleDataValues(size));
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L739-L743
|
a9b6424315b78daa9d438b03eb65a9802d44fc1d
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/util/ChatTools.ets
|
arkts
|
getTimeSegmentStr
|
将一个两位24小时时间的转换为上午、下午这样的描述。
@param hh24 两位的24小时制时间的小时部分
@return 如果成功转换则返回形如:“凌晨”、“上午”等,否则返回空字符串(不是null)
@since 3.1
|
static getTimeSegmentStr(hh24: string): string {
let ret: string = '';
if (hh24 && hh24.length >= 2) {
try {
// 取出“小时”部分
let a = parseInt(hh24.substring(0, 2));
if (a >= 0 && a <= 6) {
ret = "凌晨";
} else if (a > 6 && a <= 12) {
ret = "上午";
} else if (a > 12 && a <= 13) {
ret = "中午";
} else if (a > 13 && a <= 18) {
ret = "下午";
} else if (a > 18 && a <= 24) {
ret = "晚上";
}
} catch (e) {
console.error("【DEBUG-getTimeSegmentStr】计算出错:" + JSON.stringify(e) + " 【NO】");
}
}
return ret;
}
|
AST#method_declaration#Left static getTimeSegmentStr AST#parameter_list#Left ( AST#parameter#Left hh24 : 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#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ret : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left hh24 AST#expression#Right && AST#expression#Left hh24 AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right >= AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 取出“小时”部分 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left a = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hh24 AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right <= AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = AST#expression#Left "凌晨" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right > AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right <= AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = AST#expression#Left "上午" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right > AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right <= AST#expression#Left 13 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = AST#expression#Left "中午" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right > AST#expression#Left 13 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right <= AST#expression#Left 18 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = AST#expression#Left "下午" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right > AST#expression#Left 18 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right <= AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = AST#expression#Left "晚上" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "【DEBUG-getTimeSegmentStr】计算出错:" AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left " 【NO】" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left ret AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getTimeSegmentStr(hh24: string): string {
let ret: string = '';
if (hh24 && hh24.length >= 2) {
try {
let a = parseInt(hh24.substring(0, 2));
if (a >= 0 && a <= 6) {
ret = "凌晨";
} else if (a > 6 && a <= 12) {
ret = "上午";
} else if (a > 12 && a <= 13) {
ret = "中午";
} else if (a > 13 && a <= 18) {
ret = "下午";
} else if (a > 18 && a <= 24) {
ret = "晚上";
}
} catch (e) {
console.error("【DEBUG-getTimeSegmentStr】计算出错:" + JSON.stringify(e) + " 【NO】");
}
}
return ret;
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L282-L305
|
a09546cc35352c12276dfb65ad18d6ab5177e891
|
gitee
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_module_ui/ace_ets_module_information/ace_ets_module_information_api16/entry/src/main/ets/MainAbility/pages/dataPanel/DataPanelContentModifier.ets
|
arkts
|
buildDataPanel
|
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, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Builder
function buildDataPanel(config: DataPanelConfiguration) {
Column() {
Column() {
ForEach(config.values, (item: number, index: number) => {
ChildItem({ item: item, index: index, max: config.maxValue })
}, (item: string) => item)
}.padding(10)
Column() {
Line().width('100%').backgroundColor('#ff373737').margin({ bottom: 5 })
}.padding({ left: 20, right: 20 })
Row() {
Text('Length=' + config.values.length + ' ').margin({ left: 10 }).align(Alignment.Start)
Text('Max=' + config.maxValue).margin({ left: 10 }).align(Alignment.Start).id('DataPanelContentModifier_max')
}
}
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildDataPanel AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left DataPanelConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . values AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ChildItem ( AST#component_parameters#Left { AST#component_parameter#Left item : AST#expression#Left item AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left index : AST#expression#Left index AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left max : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . maxValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : 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#expression#Left item AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Line ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ff373737' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Length=' AST#expression#Right + AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . values AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right + AST#expression#Left ' ' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Max=' AST#expression#Right + AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . maxValue AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'DataPanelContentModifier_max' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_function_declaration#Right
|
@Builder
function buildDataPanel(config: DataPanelConfiguration) {
Column() {
Column() {
ForEach(config.values, (item: number, index: number) => {
ChildItem({ item: item, index: index, max: config.maxValue })
}, (item: string) => item)
}.padding(10)
Column() {
Line().width('100%').backgroundColor('#ff373737').margin({ bottom: 5 })
}.padding({ left: 20, right: 20 })
Row() {
Text('Length=' + config.values.length + ' ').margin({ left: 10 }).align(Alignment.Start)
Text('Max=' + config.maxValue).margin({ left: 10 }).align(Alignment.Start).id('DataPanelContentModifier_max')
}
}
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_information/ace_ets_module_information_api16/entry/src/main/ets/MainAbility/pages/dataPanel/DataPanelContentModifier.ets#L15-L33
|
c6839ac1f14796fc476f8e2c7c10f789a4dcfcb8
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/components/AxisBase.ets
|
arkts
|
setGridColor
|
Sets the color of the grid lines for this axis (the horizontal lines
coming from each label).
@param color
|
public setGridColor(color: number): void {
this.mGridColor = color;
}
|
AST#method_declaration#Left public setGridColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mGridColor AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setGridColor(color: number): void {
this.mGridColor = color;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L245-L247
|
896ea79132b3d597f817146dc981c38b45212ac5
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/settings/SettingsService.ets
|
arkts
|
getAISettings
|
获取AI设置
@returns AI设置
|
async getAISettings(): Promise<AISettings> {
const settings = await this.getSettings();
return settings.ai;
}
|
AST#method_declaration#Left async getAISettings 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 AISettings AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left settings = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left settings AST#expression#Right . ai AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getAISettings(): Promise<AISettings> {
const settings = await this.getSettings();
return settings.ai;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L248-L251
|
a5886aabb8d0e290dab0ec24268643a6bcdc5659
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets
|
arkts
|
getFirstGridData
|
主页第一个模块数据
@return {Array<GridItem>} firstGridData.
|
getFirstGridData(): Array<GridItem> {
let firstGridData: GridItem[] = [
new GridItem($r('app.string.my_love'), $r('app.media.ic_love')),
new GridItem($r('app.string.history_record'), $r('app.media.ic_record')),
new GridItem($r('app.string.message'), $r('app.media.ic_message')),
new GridItem($r('app.string.shopping_cart'), $r('app.media.ic_shopping')),
new GridItem($r('app.string.my_goal'), $r('app.media.ic_target')),
new GridItem($r('app.string.group'), $r('app.media.ic_circle')),
new GridItem($r('app.string.favorites'), $r('app.media.ic_favorite')),
new GridItem($r('app.string.recycle_bin'), $r('app.media.ic_recycle'))
];
return firstGridData;
}
|
AST#method_declaration#Left getFirstGridData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GridItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left firstGridData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left GridItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.my_love' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_love' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.history_record' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_record' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_message' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.shopping_cart' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_shopping' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.my_goal' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_target' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.group' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_circle' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.favorites' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_favorite' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.recycle_bin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_recycle' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left firstGridData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getFirstGridData(): Array<GridItem> {
let firstGridData: GridItem[] = [
new GridItem($r('app.string.my_love'), $r('app.media.ic_love')),
new GridItem($r('app.string.history_record'), $r('app.media.ic_record')),
new GridItem($r('app.string.message'), $r('app.media.ic_message')),
new GridItem($r('app.string.shopping_cart'), $r('app.media.ic_shopping')),
new GridItem($r('app.string.my_goal'), $r('app.media.ic_target')),
new GridItem($r('app.string.group'), $r('app.media.ic_circle')),
new GridItem($r('app.string.favorites'), $r('app.media.ic_favorite')),
new GridItem($r('app.string.recycle_bin'), $r('app.media.ic_recycle'))
];
return firstGridData;
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets#L40-L52
|
1cfdf8b8fe963228dd4a8f57b06813593cc8a831
|
gitee
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/highlight/PieRadarHighlighter.ets
|
arkts
|
getClosestHighlight
|
Returns the closest Highlight object of the given objects based on the touch position inside the chart.
@param index
@param x
@param y
@return
|
protected abstract getClosestHighlight(index: number, x: number, y: number): Highlight | null;
|
AST#method_declaration#Left protected abstract getClosestHighlight AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : 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#union_type#Left AST#primary_type#Left Highlight AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
protected abstract getClosestHighlight(index: number, x: number, y: number): Highlight | null;
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/PieRadarHighlighter.ets#L78-L78
|
ca54dec1217305473d67e8f1979542b35117bee1
|
gitee
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/core/src/main/ets/datasource/BasicDataSource.ets
|
arkts
|
notifyDataMove
|
通知LazyForEach组件将from索引和to索引处的子组件进行交换
|
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
}
|
AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left listener AST#expression#Right . onDataMove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left from AST#expression#Right , AST#expression#Left to AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/datasource/BasicDataSource.ets#L96-L100
|
fb1929c2d39cfa85a26a04cc38a5428ec4db2190
|
gitee
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserGuildSettings.ets
|
arkts
|
update
|
Update a specific property of the guild settings.
|
update(name: string, value: any): Promise<Object> {
// 应用约束:对象字面量动态属性(约束5),使用Map替代
const updateData = new Map<string, any>();
updateData.set(name, value);
return this.client.rest.methods.patchClientUserGuildSettings(
this.guildID,
updateData
);
}
|
AST#method_declaration#Left update 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 value : AST#type_annotation#Left AST#primary_type#Left any 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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 应用约束:对象字面量动态属性(约束5),使用Map替代 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left updateData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left updateData AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right , AST#expression#Left value AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . rest AST#member_expression#Right AST#expression#Right . methods AST#member_expression#Right AST#expression#Right . patchClientUserGuildSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . guildID AST#member_expression#Right AST#expression#Right , AST#expression#Left updateData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
update(name: string, value: any): Promise<Object> {
const updateData = new Map<string, any>();
updateData.set(name, value);
return this.client.rest.methods.patchClientUserGuildSettings(
this.guildID,
updateData
);
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserGuildSettings.ets#L59-L67
|
eb703645bd110a2179f0edcdea379c640fab65a7
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/utils/NotificationUtils.ets
|
arkts
|
getDefaultWantAgent
|
创建一个可拉起Ability的Want
@returns
|
static async getDefaultWantAgent(uri: string = ''): Promise<WantAgent> {
const context = ArkWebHelper.getContext(); //获取当前上下文对象
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
deviceId: '',
bundleName: context.abilityInfo.bundleName,
moduleName: context.abilityInfo.moduleName,
abilityName: context.abilityInfo.name,
action: 'action_notice',
entities: [],
uri: uri,
}
],
actionType: wantAgent.OperationType.START_ABILITY | wantAgent.OperationType.SEND_COMMON_EVENT,
requestCode: 0,
actionFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG]
};
return wantAgent.getWantAgent(wantAgentInfo);
}
|
AST#method_declaration#Left static async getDefaultWantAgent AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) 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 WantAgent AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ArkWebHelper AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //获取当前上下文对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left wantAgentInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left wantAgent . WantAgentInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left deviceId AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left moduleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . moduleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . abilityInfo AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'action_notice' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left entities AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uri AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left actionType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . START_ABILITY AST#member_expression#Right AST#expression#Right | AST#expression#Left wantAgent AST#expression#Right AST#binary_expression#Right AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . SEND_COMMON_EVENT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left requestCode AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left actionFlags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . WantAgentFlags AST#member_expression#Right AST#expression#Right . CONSTANT_FLAG AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wantAgent AST#expression#Right . getWantAgent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wantAgentInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async getDefaultWantAgent(uri: string = ''): Promise<WantAgent> {
const context = ArkWebHelper.getContext();
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
deviceId: '',
bundleName: context.abilityInfo.bundleName,
moduleName: context.abilityInfo.moduleName,
abilityName: context.abilityInfo.name,
action: 'action_notice',
entities: [],
uri: uri,
}
],
actionType: wantAgent.OperationType.START_ABILITY | wantAgent.OperationType.SEND_COMMON_EVENT,
requestCode: 0,
actionFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG]
};
return wantAgent.getWantAgent(wantAgentInfo);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L449-L468
|
0247835126dda732754efd5ec9ef0b02d5148114
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
slider small track thick ness
|
export const SMALL_TRACK_THICK_NESS: number = 2;
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SMALL_TRACK_THICK_NESS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const SMALL_TRACK_THICK_NESS: number = 2;
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L59-L59
|
ead264e66165f6d63c28e0a848b0d748e57292ff
|
gitee
|
|
2763981847/Clock-Alarm.git
|
8949bedddb7d011021848196735f30ffe2bd1daf
|
entry/src/main/ets/model/database/PreferencesHandler.ets
|
arkts
|
addPreferencesListener
|
添加用户首选项变化监听器,以便在数据变化时得到通知。
@param listener 偏好设置监听器对象
|
public addPreferencesListener(listener: PreferencesListener) {
this.listeners.push(listener);
}
|
AST#method_declaration#Left public addPreferencesListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left PreferencesListener 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public addPreferencesListener(listener: PreferencesListener) {
this.listeners.push(listener);
}
|
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L74-L76
|
e584d5b8ea51bf95335841ce87964c47fcf0c91a
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/util/src/main/ets/image/ImageUtil.ets
|
arkts
|
pixelMapToBase64
|
PixelMap转base64
@param {image.PixelMap} pixelMap 图像的PixelMap对象
@param {string} format 目标格式(默认png,当前只支持jpg、webp和png)
@returns {Promise<string>} 返回图像的base64字符串
|
static async pixelMapToBase64(pixelMap: image.PixelMap, format: string = 'image/png'): Promise<string> {
const options: image.PackingOption = { format: format, quality: 100 };
const arrayBuffer: ArrayBuffer = await ImageUtil.packingFromPixelMap(pixelMap, options);
const base64Helper: util.Base64Helper = new util.Base64Helper();
const BASE64_DATA_HEAD: string = `data:${format};base64,`;
let base64Str: string = base64Helper.encodeToStringSync(new Uint8Array(arrayBuffer));
if (!base64Str.startsWith(BASE64_DATA_HEAD)) {
base64Str = BASE64_DATA_HEAD + base64Str;
}
return base64Str;
}
|
AST#method_declaration#Left static async pixelMapToBase64 AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'image/png' AST#expression#Right AST#parameter#Right ) 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PackingOption AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left format AST#property_name#Right : AST#expression#Left format AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left quality AST#property_name#Right : AST#expression#Left 100 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left arrayBuffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left ImageUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . packingFromPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left base64Helper : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . Base64Helper AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . Base64Helper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left BASE64_DATA_HEAD : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` data: AST#template_substitution#Left $ { AST#expression#Left format AST#expression#Right } AST#template_substitution#Right ;base64, ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left base64Str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64Helper AST#expression#Right . encodeToStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left arrayBuffer AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left base64Str AST#expression#Right AST#unary_expression#Right AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left BASE64_DATA_HEAD AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left base64Str = AST#expression#Left AST#binary_expression#Left AST#expression#Left BASE64_DATA_HEAD AST#expression#Right + AST#expression#Left base64Str AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left base64Str AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async pixelMapToBase64(pixelMap: image.PixelMap, format: string = 'image/png'): Promise<string> {
const options: image.PackingOption = { format: format, quality: 100 };
const arrayBuffer: ArrayBuffer = await ImageUtil.packingFromPixelMap(pixelMap, options);
const base64Helper: util.Base64Helper = new util.Base64Helper();
const BASE64_DATA_HEAD: string = `data:${format};base64,`;
let base64Str: string = base64Helper.encodeToStringSync(new Uint8Array(arrayBuffer));
if (!base64Str.startsWith(BASE64_DATA_HEAD)) {
base64Str = BASE64_DATA_HEAD + base64Str;
}
return base64Str;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/image/ImageUtil.ets#L64-L74
|
6f36873469b499ffef880c1dfd20541b0728715a
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/SearchPage.ets
|
arkts
|
buildHotSearchSection
|
构建热门搜索区域
|
@Builder
buildHotSearchSection() {
Column({ space: 12 }) {
Row() {
Image($r('app.media.ic_hot'))
.width(16)
.height(16)
.fillColor('#ff6b6b')
Text('热门搜索')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.margin({ left: 4 })
}
.alignSelf(ItemAlign.Start)
Flex({ wrap: FlexWrap.Wrap, space: { main: 8, cross: 8 } }) {
ForEach(this.hotSearches, (keyword: string) => {
this.buildSearchTag(keyword, () => {
this.onSearchSuggestionTap(keyword);
}, '#ffebee')
})
}
.width('100%')
}
.width('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHotSearchSection 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_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_hot' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#ff6b6b' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '热门搜索' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( AST#component_parameters#Left { AST#component_parameter#Left wrap : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexWrap AST#expression#Right . Wrap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left space : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left main AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cross AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hotSearches AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left keyword : 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#ui_arrow_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 . buildSearchTag AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#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 . onSearchSuggestionTap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left '#ffebee' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildHotSearchSection() {
Column({ space: 12 }) {
Row() {
Image($r('app.media.ic_hot'))
.width(16)
.height(16)
.fillColor('#ff6b6b')
Text('热门搜索')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.margin({ left: 4 })
}
.alignSelf(ItemAlign.Start)
Flex({ wrap: FlexWrap.Wrap, space: { main: 8, cross: 8 } }) {
ForEach(this.hotSearches, (keyword: string) => {
this.buildSearchTag(keyword, () => {
this.onSearchSuggestionTap(keyword);
}, '#ffebee')
})
}
.width('100%')
}
.width('100%')
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/SearchPage.ets#L361-L388
|
b63931f678073f79a65a015542566cd74c47c3d7
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/pageloading/src/main/ets/view/CommodityList.ets
|
arkts
|
CommodityList
|
自上而下渐变
|
@Component
export struct CommodityList {
private commodityData: CommodityDataSource = new CommodityDataSource();
aboutToAppear() {
this.commodityData.pushData(PRODUCTS_DATA)
}
build() {
Column() {
Column() {
Image($r("app.media.page_loading_light_mode_banner"))
.objectFit(ImageFit.Contain)
.borderRadius($r("app.integer.page_loading_banner_border_radius"))
.margin({ top: $r("app.integer.page_loading_banner_margin_top") })
.width('100%')
.shadow({
radius: $r("app.integer.page_loading_banner_shadow_border_radius"),
color: $r("app.color.page_loading_banner_shadow_color"),
offsetX: OFFSETX,
offsetY: OFFSETY
})
Text($r("app.string.page_loading_goods_title_text"))
.fontColor(Color.Black)
.fontSize($r("app.integer.page_loading_commodity_font"))
.fontWeight(FontWeight.Bold)
.height($r("app.integer.page_loading_new_commodity_height"))
.width('100%')
.textAlign(TextAlign.Center)
}
.padding({ left: $r("app.integer.page_loading_column_padding_left"), right: $r("app.integer.page_loading_column_padding_right") })
.backgroundColor(Color.White)
List() {
LazyForEach(this.commodityData, (item: CommodityDataModel) => {
ListItem() {
ItemView({ item: item })
}
.padding({
left: $r("app.integer.page_loading_commodity_list_item_padding"),
right: $r("app.integer.page_loading_commodity_list_item_padding")
})
.margin({ top: $r("app.integer.page_loading_commodity_list_item_margin_top") })
}, (item: CommodityDataModel) => item.id.toString())
}
.id('commodity_list')
.width('100%')
.layoutWeight(LAYOUT_WEIGHT)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
// 设置背景颜色渐变
.linearGradient({
angle: ANGLE,
colors: [[0xFFFFFF, 0.0], [0xdddddd, 1.0]]
})
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommodityList AST#component_body#Left { AST#property_declaration#Left private commodityData : AST#type_annotation#Left AST#primary_type#Left CommodityDataSource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CommodityDataSource AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right 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 this AST#expression#Right . commodityData AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left PRODUCTS_DATA AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right 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_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.page_loading_light_mode_banner" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_banner_border_radius" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_banner_margin_top" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_banner_shadow_border_radius" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.page_loading_banner_shadow_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left OFFSETX AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left OFFSETY AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.page_loading_goods_title_text" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_commodity_font" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_new_commodity_height" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_column_padding_left" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_column_padding_right" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commodityData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CommodityDataModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ItemView ( AST#component_parameters#Left { AST#component_parameter#Left item : AST#expression#Left item AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_commodity_list_item_padding" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_commodity_list_item_padding" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.integer.page_loading_commodity_list_item_margin_top" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CommodityDataModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'commodity_list' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left LAYOUT_WEIGHT AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // 设置背景颜色渐变 AST#modifier_chain_expression#Left . linearGradient ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left ANGLE AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left colors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0xFFFFFF AST#expression#Right , AST#expression#Left 0.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0xdddddd AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CommodityList {
private commodityData: CommodityDataSource = new CommodityDataSource();
aboutToAppear() {
this.commodityData.pushData(PRODUCTS_DATA)
}
build() {
Column() {
Column() {
Image($r("app.media.page_loading_light_mode_banner"))
.objectFit(ImageFit.Contain)
.borderRadius($r("app.integer.page_loading_banner_border_radius"))
.margin({ top: $r("app.integer.page_loading_banner_margin_top") })
.width('100%')
.shadow({
radius: $r("app.integer.page_loading_banner_shadow_border_radius"),
color: $r("app.color.page_loading_banner_shadow_color"),
offsetX: OFFSETX,
offsetY: OFFSETY
})
Text($r("app.string.page_loading_goods_title_text"))
.fontColor(Color.Black)
.fontSize($r("app.integer.page_loading_commodity_font"))
.fontWeight(FontWeight.Bold)
.height($r("app.integer.page_loading_new_commodity_height"))
.width('100%')
.textAlign(TextAlign.Center)
}
.padding({ left: $r("app.integer.page_loading_column_padding_left"), right: $r("app.integer.page_loading_column_padding_right") })
.backgroundColor(Color.White)
List() {
LazyForEach(this.commodityData, (item: CommodityDataModel) => {
ListItem() {
ItemView({ item: item })
}
.padding({
left: $r("app.integer.page_loading_commodity_list_item_padding"),
right: $r("app.integer.page_loading_commodity_list_item_padding")
})
.margin({ top: $r("app.integer.page_loading_commodity_list_item_margin_top") })
}, (item: CommodityDataModel) => item.id.toString())
}
.id('commodity_list')
.width('100%')
.layoutWeight(LAYOUT_WEIGHT)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
.linearGradient({
angle: ANGLE,
colors: [[0xFFFFFF, 0.0], [0xdddddd, 1.0]]
})
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageloading/src/main/ets/view/CommodityList.ets#L28-L86
|
4b426aae4968daffe0b65e9eb1d88d98655893ac
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/main/sub/list/SubListOneView.ets
|
arkts
|
updateSelectedIndexOnScroll
|
根据滚动位置更新选中的字母索引
|
private updateSelectedIndexOnScroll(index: number): void {
const sections = this.sectionWords.allSections();
///ListGroup整体占一个索引,所以index是ListGroup的索引
if (index >0 && index < sections.length) {
let char = sections[index]
let i = this.indexers.findIndex((ch, index)=> char === ch)
if (i > 0 && i < this.indexers.length) {
this.selectedIndexOfIndexers = i
}
}
}
|
AST#method_declaration#Left private updateSelectedIndexOnScroll AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sections = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sectionWords AST#member_expression#Right AST#expression#Right . allSections AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right ///ListGroup整体占一个索引,所以index是ListGroup的索引 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left sections AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left char = AST#expression#Left AST#subscript_expression#Left AST#expression#Left sections AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . indexers AST#member_expression#Right AST#expression#Right . findIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ch AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right === AST#expression#Left ch AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left i AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . indexers AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#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 . selectedIndexOfIndexers AST#member_expression#Right = AST#expression#Left i AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private updateSelectedIndexOnScroll(index: number): void {
const sections = this.sectionWords.allSections();
if (index >0 && index < sections.length) {
let char = sections[index]
let i = this.indexers.findIndex((ch, index)=> char === ch)
if (i > 0 && i < this.indexers.length) {
this.selectedIndexOfIndexers = i
}
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/list/SubListOneView.ets#L101-L115
|
e266fcd5229e1eb0252dde5f1ccdd503b8fee9f2
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets
|
arkts
|
testEccUseCommKeySpecGet
|
根据EccCommonSpec实例生成ECC密钥对,获取密钥规格
|
function testEccUseCommKeySpecGet() {
try {
let commKeySpec = genEccCommonSpec(); // 使用参数属性,构造ECC公私钥公共密钥参数对象
let generatorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(commKeySpec); // 使用密钥参数对象创建生成器
let keyPairPromise = generatorBySpec.generateKeyPair(); // Generate an ECC key pair.
keyPairPromise.then(keyPair => { // 使用生成器创建ECC密钥对
showEccSpecDetailInfo(keyPair.priKey, 'priKey'); // 对私钥获取相关密钥参数属性
showEccSpecDetailInfo(keyPair.pubKey, 'pubKey'); // 对公钥获取相关密钥参数属性
}).catch((error: BusinessError) => {
// 逻辑错误等异步异常在此捕获
console.error('generateComm error');
console.error('error code: ' + error.code + ', message is: ' + error.message);
})
} catch (error) {
// 参数错误等同步异常在此捕获
console.error('testEccUseCommSpec error');
let e: BusinessError = error as BusinessError;
console.error(`ecc comm spec failed, ${e.code}, ${e.message}`);
}
}
|
AST#function_declaration#Left function testEccUseCommKeySpecGet AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left commKeySpec = AST#expression#Left AST#call_expression#Left AST#expression#Left genEccCommonSpec AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 使用参数属性,构造ECC公私钥公共密钥参数对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left generatorBySpec = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createAsyKeyGeneratorBySpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left commKeySpec AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 使用密钥参数对象创建生成器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPairPromise = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left generatorBySpec AST#expression#Right . generateKeyPair AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Generate an ECC key pair. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairPromise AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left keyPair => AST#block_statement#Left { // 使用生成器创建ECC密钥对 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showEccSpecDetailInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left keyPair AST#expression#Right . priKey AST#member_expression#Right AST#expression#Right , AST#expression#Left 'priKey' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 对私钥获取相关密钥参数属性 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left showEccSpecDetailInfo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left keyPair AST#expression#Right . pubKey AST#member_expression#Right AST#expression#Right , AST#expression#Left 'pubKey' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 对公钥获取相关密钥参数属性 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 逻辑错误等异步异常在此捕获 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'generateComm error' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'error code: ' AST#expression#Right + AST#expression#Left error AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right + AST#expression#Left ', message is: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left error AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { // 参数错误等同步异常在此捕获 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'testEccUseCommSpec error' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` ecc comm spec failed, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function testEccUseCommKeySpecGet() {
try {
let commKeySpec = genEccCommonSpec();
let generatorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(commKeySpec);
let keyPairPromise = generatorBySpec.generateKeyPair();
keyPairPromise.then(keyPair => {
showEccSpecDetailInfo(keyPair.priKey, 'priKey');
showEccSpecDetailInfo(keyPair.pubKey, 'pubKey');
}).catch((error: BusinessError) => {
console.error('generateComm error');
console.error('error code: ' + error.code + ', message is: ' + error.message);
})
} catch (error) {
console.error('testEccUseCommSpec error');
let e: BusinessError = error as BusinessError;
console.error(`ecc comm spec failed, ${e.code}, ${e.message}`);
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets#L100-L119
|
10348853deb64d135a42bb7f8a9720c88aa9d92a
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets
|
arkts
|
countDownLatch
|
计时
|
private async countDownLatch(count: number) {
while (count > 0) {
await this.sleep(40)
count--
}
}
|
AST#method_declaration#Left private async countDownLatch AST#parameter_list#Left ( AST#parameter#Left count : 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#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . sleep AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 40 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left count AST#expression#Right -- AST#update_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async countDownLatch(count: number) {
while (count > 0) {
await this.sleep(40)
count--
}
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets#L79-L84
|
53f6114ecbf7784c3e94494f849557c1b7213693
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangSeekBarOption.ets
|
arkts
|
视频剪辑长度选项
|
export class RangSeekBarOption {
// 左边进度位置
public mLeftProgressPos: number = 0;
// 右边进度位置
public mRightProgressPos: number = 10;
// 最小时间 比如一屏幕10张图 间隔10s, 现在最小时间是3s,那么leftThumb和rightThumb的最小间隔是3张图宽度
public mMinShootTime: number = 3;
// 最大时间 约束了右侧thumb和左侧thumb的距离
public mMaxShootTime: number = 10;
// 一屏幕展示最大图片数量, 一张图是1s,如果最大数量是20, 最大时间是10s,那么 rightThumb 距离 leftThumb 就是屏幕的10/20
// 需要保证mMaxCountRange <= mMaxShootTime 否则右侧的thumb会出界
public mMaxCountRange: number = 10;
public mThumbWidth: number = 30
// 距离上下padding
public mPaddingTopBottom: number = 10;
constructor() {
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class RangSeekBarOption AST#class_body#Left { // 左边进度位置 AST#property_declaration#Left public mLeftProgressPos : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 右边进度位置 AST#property_declaration#Left public mRightProgressPos : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right // 最小时间 比如一屏幕10张图 间隔10s, 现在最小时间是3s,那么leftThumb和rightThumb的最小间隔是3张图宽度 AST#property_declaration#Left public mMinShootTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right // 最大时间 约束了右侧thumb和左侧thumb的距离 AST#property_declaration#Left public mMaxShootTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right // 一屏幕展示最大图片数量, 一张图是1s,如果最大数量是20, 最大时间是10s,那么 rightThumb 距离 leftThumb 就是屏幕的10/20 // 需要保证mMaxCountRange <= mMaxShootTime 否则右侧的thumb会出界 AST#property_declaration#Left public mMaxCountRange : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public mThumbWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right // 距离上下padding AST#property_declaration#Right AST#property_declaration#Left public mPaddingTopBottom : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class RangSeekBarOption {
public mLeftProgressPos: number = 0;
public mRightProgressPos: number = 10;
public mMinShootTime: number = 3;
public mMaxShootTime: number = 10;
public mMaxCountRange: number = 10;
public mThumbWidth: number = 30
public mPaddingTopBottom: number = 10;
constructor() {
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangSeekBarOption.ets#L19-L37
|
5c867726734ef1d19a047a2769c92157d11e3c5d
|
gitee
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Column.ets
|
arkts
|
渲染布局
@returns {void} 无返回值
@example
ColumnSpaceEvenly() { Text("A"); Text("B"); Text("C"); }
|
build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
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 ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceEvenly AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right
|
build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L604-L619
|
2941f1fe36d454983d4b024ada5b884642d5691e
|
github
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/processes/tabs_actions.ets
|
arkts
|
Cancel in-page search for current tab.
@param storage The LocalStorage.
|
export function cancel_in_page_search(storage: LocalStorage) {
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
storage.set('current_in_page_searching_keyword', '');
storage.set('current_in_page_searching_stats_current', 0);
storage.set('current_in_page_searching_stats_total', 0);
tabs.workingMainTab().searching_keyword_stats_current = 0;
tabs.workingMainTab().searching_keyword_stats_total = 0;
tabs.workingMainTab().searching_keyword = '';
try {
tabs.workingMainTab().controller?.clearMatches();
} catch (e) {
console.error('[cancel_in_page_search] Failed: ' + e);
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function cancel_in_page_search AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tabs = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left storage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bunch_of_tabs' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left bunch_of_tabs AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left storage AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'current_in_page_searching_keyword' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left storage AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'current_in_page_searching_stats_current' AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left storage AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'current_in_page_searching_stats_total' AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tabs AST#expression#Right . workingMainTab AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . searching_keyword_stats_current AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tabs AST#expression#Right . workingMainTab AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . searching_keyword_stats_total AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tabs AST#expression#Right . workingMainTab AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . searching_keyword AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tabs AST#expression#Right . workingMainTab AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ?. clearMatches AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '[cancel_in_page_search] Failed: ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function cancel_in_page_search(storage: LocalStorage) {
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
storage.set('current_in_page_searching_keyword', '');
storage.set('current_in_page_searching_stats_current', 0);
storage.set('current_in_page_searching_stats_total', 0);
tabs.workingMainTab().searching_keyword_stats_current = 0;
tabs.workingMainTab().searching_keyword_stats_total = 0;
tabs.workingMainTab().searching_keyword = '';
try {
tabs.workingMainTab().controller?.clearMatches();
} catch (e) {
console.error('[cancel_in_page_search] Failed: ' + e);
}
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/tabs_actions.ets#L148-L161
|
3a46f08d5bb6d7436a313b46b17fde8ce31bd934
|
gitee
|
|
openharmony/notification_common_event_service
|
5ee1b4f273fe5bab5c2c14b85b7efbd76ece9558
|
interfaces/kits/ani/common_event/ets/commonEvent/commonEventSubscribeInfo.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, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export interface CommonEventSubscribeInfo {
events: Array<string>;
publisherPermission?: string;
publisherDeviceId?: string;
userId?: number;
priority?: number;
publisherBundleName?: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface CommonEventSubscribeInfo AST#object_type#Left { AST#type_member#Left events : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left publisherPermission ? : 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 publisherDeviceId ? : 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 userId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left priority ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left publisherBundleName ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface CommonEventSubscribeInfo {
events: Array<string>;
publisherPermission?: string;
publisherDeviceId?: string;
userId?: number;
priority?: number;
publisherBundleName?: string;
}
|
https://github.com/openharmony/notification_common_event_service/blob/5ee1b4f273fe5bab5c2c14b85b7efbd76ece9558/interfaces/kits/ani/common_event/ets/commonEvent/commonEventSubscribeInfo.ets#L16-L23
|
444cbb17bdbb77f897b51b934bb001e1311495ac
|
gitee
|
|
openharmony/communication_wifi
|
387ba7fa8f98578629a6148635a4d630b2b99aa1
|
wifi/frameworks/ets/ani/wifi_manager/ets/@ohos.wifiManager.ets
|
arkts
|
loadLibrary
|
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, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export namespace wifiManager {
loadLibrary
|
AST#export_declaration#Left export AST#ERROR#Left namespace w if iManager AST#ERROR#Right { loadLibrary AST#export_declaration#Right
|
export namespace wifiManager {
loadLibrary
|
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/frameworks/ets/ani/wifi_manager/ets/@ohos.wifiManager.ets#L16-L17
|
5cf780461cdb7d21a7358d787216aa7ae9a414ae
|
gitee
|
lime-zz/Ark-ui_RubbishRecycleApp.git
|
c2a9bff8fbb5bc46d922934afad0327cc1696969
|
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
|
arkts
|
updateDisplayData
|
将数据库数据转换为UI显示数据
|
updateDisplayData(): void {
this.datas = this.cartItems.map((item: CartItem): Type1 => {
return {
img: this.getImageByKey(item.image_key), // 根据image_key映射
contents: item.product_name,
dvalue: `${item.price}币`, // 原价
cvalue: `${item.price}币`, // 现价(这里假设没有折扣)
amount: `X${item.quantity}`,
avalue: `${item.total_price}币`,
img1: $r('app.media.lajitong'),
selected: false
} as Type1;
});
}
|
AST#method_declaration#Left updateDisplayData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . datas AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cartItems AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CartItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Type1 AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left img AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getImageByKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . image_key AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , // 根据image_key映射 AST#property_assignment#Left AST#property_name#Left contents AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . product_name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dvalue AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . price AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 币 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , // 原价 AST#property_assignment#Left AST#property_name#Left cvalue AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . price AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 币 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , // 现价(这里假设没有折扣) AST#property_assignment#Left AST#property_name#Left amount AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` X AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . quantity AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left avalue AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . total_price AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 币 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left img1 AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.lajitong' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Type1 AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
updateDisplayData(): void {
this.datas = this.cartItems.map((item: CartItem): Type1 => {
return {
img: this.getImageByKey(item.image_key),
contents: item.product_name,
dvalue: `${item.price}币`,
cvalue: `${item.price}币`,
amount: `X${item.quantity}`,
avalue: `${item.total_price}币`,
img1: $r('app.media.lajitong'),
selected: false
} as Type1;
});
}
|
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L223-L236
|
5710b7c96613e70a7d2132eb615e57afc39be7c0
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets
|
arkts
|
视频遮罩层数据
|
export interface VideoMaskData {
name: string; // 博主名称
description: string; // 视频描述
time: string; // 视频日期
head: ResourceStr; // 头像路径
likeCount: string; // 点赞数量
commentCount: string; // 评论数量
favoriteCount: string; // 收藏数量
shareCount: string; // 分享次数
hotspot: string; // 热点
commentDataSource: CommentDataSource; // 评论数据
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface VideoMaskData AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 博主名称 AST#type_member#Left description : 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 time : 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 head : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 头像路径 AST#type_member#Left likeCount : 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 commentCount : 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 favoriteCount : 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 shareCount : 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 hotspot : 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 commentDataSource : AST#type_annotation#Left AST#primary_type#Left CommentDataSource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 评论数据 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface VideoMaskData {
name: string;
description: string;
time: string;
head: ResourceStr;
likeCount: string;
commentCount: string;
favoriteCount: string;
shareCount: string;
hotspot: string;
commentDataSource: CommentDataSource;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L31-L42
|
9ced77b980faf6f2a06b2752cbc06da2340e3f42
|
gitee
|
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
|
arkts
|
setOrCreate
|
Called when setting or creating.
@since 10
|
static setOrCreate<T>(propName: string, newValue: T): void {
StorageMap.shared.set(propName, newValue, true)
}
|
AST#method_declaration#Left static setOrCreate AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newValue : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#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 StorageMap AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left propName AST#expression#Right , AST#expression#Left newValue AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static setOrCreate<T>(propName: string, newValue: T): void {
StorageMap.shared.set(propName, newValue, true)
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L172-L174
|
35bf7738b8ece9ef541ea3d3e8bdef550d34c645
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/common/i18n/I18nManager.ets
|
arkts
|
getTranslationByKey
|
根据键获取翻译
|
private getTranslationByKey(key: string, language: SupportedLanguage): string | undefined {
const translations = this.translations.get(language);
if (!translations) return undefined;
const keys = key.split('.');
let current: any = translations;
for (const k of keys) {
if (current && typeof current === 'object' && k in current) {
current = current[k];
} else {
return undefined;
}
}
return typeof current === 'string' ? current : undefined;
}
/**
* 格式化字符串
*/
private formatString(template: string, params?: FormatParams): string {
if (!params) return template;
let result = template;
for (const [key, value] of Object.entries(params)) {
const placeholder = `{${key}}`;
const replacement = typeof value === 'string' ? value : String(value);
result = result.replace(new RegExp(placeholder, 'g'), replacement);
}
return result;
}
|
AST#method_declaration#Left private getTranslationByKey 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#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left translations = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translations AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left language AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left translations AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left keys = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left key AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left current : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left translations AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const k of AST#expression#Left keys AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left current AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left current AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'object' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left k AST#expression#Right in AST#expression#Left current AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left current = AST#expression#Left AST#subscript_expression#Left AST#expression#Left current AST#expression#Right [ AST#expression#Left k AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#ERROR#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left current AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? current : AST#type_annotation#Left AST#primary_type#Left undefined AST#primary_type#Right AST#type_annotation#Right ; } /**
* 格式化字符串
*/ private AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left formatString AST#expression#Right AST#argument_list#Left ( AST#expression#Left template AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right , AST#expression#Left AST#conditional_expression#Left AST#expression#Left params AST#expression#Right ? AST#expression#Left AST#expression#Right : AST#expression#Left FormatParams AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : string { AST#property_name#Left if AST#property_name#Right ( AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left params AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left ) AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left template AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left template AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left for ( AST#ERROR#Left const AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left key AST#expression#Right , AST#expression#Left value AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#ERROR#Left of Object AST#ERROR#Right . entries AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#property_name#Left const AST#property_name#Right placeholder = AST#ERROR#Right AST#expression#Left AST#template_literal#Left ` { AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right } ` AST#template_literal#Right AST#expression#Right ; const AST#ERROR#Left replacement AST#ERROR#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left value AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#assignment_expression#Left value AST#ERROR#Left : AST#ERROR#Left String AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left value AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; result AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left RegExp AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left placeholder AST#expression#Right , AST#expression#Left 'g' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left replacement AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; } AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getTranslationByKey(key: string, language: SupportedLanguage): string | undefined {
const translations = this.translations.get(language);
if (!translations) return undefined;
const keys = key.split('.');
let current: any = translations;
for (const k of keys) {
if (current && typeof current === 'object' && k in current) {
current = current[k];
} else {
return undefined;
}
}
return typeof current === 'string' ? current : undefined;
}
private formatString(template: string, params?: FormatParams): string {
if (!params) return template;
let result = template;
for (const [key, value] of Object.entries(params)) {
const placeholder = `{${key}}`;
const replacement = typeof value === 'string' ? value : String(value);
result = result.replace(new RegExp(placeholder, 'g'), replacement);
}
return result;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/i18n/I18nManager.ets#L633-L665
|
8aa82e5b3bc12bd610c5bb7fa961c0ce3ab9582f
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/TimedReminderService.ets
|
arkts
|
updateDailyCheckTime
|
更新每日检查时间
|
public async updateDailyCheckTime(hour: number, minute: number): Promise<boolean> {
try {
// 取消现有的每日检查提醒
const existingId = `daily_check_${hour}_${minute}`;
await this.cancelReminder(existingId);
// 创建新的每日检查提醒
return await this.createDailyCheckReminder(hour, minute);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[TimedReminderService] Failed to update daily check time: ${error}`);
return false;
}
}
|
AST#method_declaration#Left public async updateDailyCheckTime AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minute : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#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 AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#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 existingId = AST#expression#Left AST#template_literal#Left ` daily_check_ AST#template_substitution#Left $ { AST#expression#Left hour AST#expression#Right } AST#template_substitution#Right _ AST#template_substitution#Left $ { AST#expression#Left minute AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . cancelReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left existingId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 创建新的每日检查提醒 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . createDailyCheckReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hour AST#expression#Right , AST#expression#Left minute AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [TimedReminderService] Failed to update daily check time: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public async updateDailyCheckTime(hour: number, minute: number): Promise<boolean> {
try {
const existingId = `daily_check_${hour}_${minute}`;
await this.cancelReminder(existingId);
return await this.createDailyCheckReminder(hour, minute);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[TimedReminderService] Failed to update daily check time: ${error}`);
return false;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L226-L239
|
64e71c6d11f86fc539d8373dc9382f529c885450
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Data/Preferences/entry/src/main/ets/view/ButtonComponent.ets
|
arkts
|
getButtonItemValues
|
Gets the data in the clicked button.
|
getButtonItemValues() {
let values: Array<ButtonItemData> = [
new ButtonItemData(
$r('app.string.write_data_btn_text'),
() => {
// Write data.
PreferenceModel.writeData(this.fruit);
}
),
new ButtonItemData(
$r('app.string.read_data_btn_text'),
() => {
// Get data from the preferences database.
PreferenceModel.getFruitData().then((resultData: Fruit) => {
if (resultData) {
this.fruit = resultData;
}
});
}
),
new ButtonItemData(
$r('app.string.delete_data_file_btn_text'),
() => {
// Delete database files.
PreferenceModel.deletePreferences();
// After a database file is deleted, the corresponding data is left blank.
this.fruit.fruitName = '';
this.fruit.fruitNum = ''
}
)
];
return values;
}
|
AST#method_declaration#Left getButtonItemValues AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left values : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ButtonItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ButtonItemData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.write_data_btn_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // Write data. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PreferenceModel AST#expression#Right . writeData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fruit AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ButtonItemData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.read_data_btn_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // Get data from the preferences database. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PreferenceModel AST#expression#Right . getFruitData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resultData : AST#type_annotation#Left AST#primary_type#Left Fruit AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left resultData AST#expression#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 . fruit AST#member_expression#Right = AST#expression#Left resultData AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ButtonItemData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.delete_data_file_btn_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // Delete database files. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PreferenceModel AST#expression#Right . deletePreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // After a database file is deleted, the corresponding data is left blank. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fruit AST#member_expression#Right AST#expression#Right . fruitName AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fruit AST#member_expression#Right AST#expression#Right . fruitNum AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left values AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getButtonItemValues() {
let values: Array<ButtonItemData> = [
new ButtonItemData(
$r('app.string.write_data_btn_text'),
() => {
PreferenceModel.writeData(this.fruit);
}
),
new ButtonItemData(
$r('app.string.read_data_btn_text'),
() => {
PreferenceModel.getFruitData().then((resultData: Fruit) => {
if (resultData) {
this.fruit = resultData;
}
});
}
),
new ButtonItemData(
$r('app.string.delete_data_file_btn_text'),
() => {
PreferenceModel.deletePreferences();
this.fruit.fruitName = '';
this.fruit.fruitNum = ''
}
)
];
return values;
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/view/ButtonComponent.ets#L49-L81
|
b2e1df12a314f199983a0a0b2c48fb40953eaa7d
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/view/CalendarView.ets
|
arkts
|
aboutToAppear
|
初始化当前月的日期排列数组 获取当前日期
|
aboutToAppear(): void {
this.dateModel = getRealTimeDate(); // 获取当前年月日信息
this.currentMonth = this.dateModel.month; // 获取当前月份
this.currentDay = this.dateModel.day; // 获取当前日
this.currentYear = this.dateModel.year; // 获取当前年份
this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear);
// 如果下个月是在下一年,则下个月是1月份,年份要+1
if (this.currentMonth === MONTHS) {
this.nextMonth = JANUARY;
this.nextYear = this.currentYear + 1;
} else {
this.nextMonth = this.currentMonth + 1;
this.nextYear = this.currentYear;
}
this.nextMonthDay = getMonthDate(this.nextMonth, this.nextYear);
// 获取当前月和下个月的日期数据
const months: Month =
{
month: `${this.currentYear}年 ${this.currentMonth}月`,
num: this.currentMonth,
days: this.currentMonthDay
}
const months2: Month =
{
month: `${this.nextYear}年 ${this.nextMonth}月`,
num: this.nextMonth,
days: this.nextMonthDay
}
this.contentData.pushData(months);
this.contentData.pushData(months2);
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#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 . dateModel AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getRealTimeDate AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取当前年月日信息 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 . currentMonth AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dateModel AST#member_expression#Right AST#expression#Right . month AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取当前月份 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 . currentDay AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dateModel AST#member_expression#Right AST#expression#Right . day AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取当前日 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 . currentYear AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dateModel AST#member_expression#Right AST#expression#Right . year AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取当前年份 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 . currentMonthDay AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getMonthDate AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentYear AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 如果下个月是在下一年,则下个月是1月份,年份要+1 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right === AST#expression#Left MONTHS AST#expression#Right AST#binary_expression#Right AST#expression#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 . nextMonth AST#member_expression#Right = AST#expression#Left JANUARY AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . nextYear AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentYear AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else 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 . nextMonth AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . nextYear AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentYear AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right 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 . nextMonthDay AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getMonthDate AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextMonth AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextYear AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取当前月和下个月的日期数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left months : AST#type_annotation#Left AST#primary_type#Left Month AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentYear AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 年 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 月 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left num AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonth AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left days AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonthDay AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left months2 : AST#type_annotation#Left AST#primary_type#Left Month AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextYear AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 年 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextMonth AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 月 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left num AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextMonth AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left days AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextMonthDay AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . contentData AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left months AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentData AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left months2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
aboutToAppear(): void {
this.dateModel = getRealTimeDate();
this.currentMonth = this.dateModel.month;
this.currentDay = this.dateModel.day;
this.currentYear = this.dateModel.year;
this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear);
if (this.currentMonth === MONTHS) {
this.nextMonth = JANUARY;
this.nextYear = this.currentYear + 1;
} else {
this.nextMonth = this.currentMonth + 1;
this.nextYear = this.currentYear;
}
this.nextMonthDay = getMonthDate(this.nextMonth, this.nextYear);
const months: Month =
{
month: `${this.currentYear}年 ${this.currentMonth}月`,
num: this.currentMonth,
days: this.currentMonthDay
}
const months2: Month =
{
month: `${this.nextYear}年 ${this.nextMonth}月`,
num: this.nextMonth,
days: this.nextMonthDay
}
this.contentData.pushData(months);
this.contentData.pushData(months2);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/view/CalendarView.ets#L118-L149
|
575aed100c309b294bf8b1408c7ab5d65a2f21fa
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/KvUtil.ets
|
arkts
|
getUint8Array
|
获取指定键的值。
@param key 要查询数据的Key
@param callback
|
static async getUint8Array(key: string, defValue?: Uint8Array): Promise<Uint8Array> {
let value = await KvUtil.get(key, defValue);
return value as Uint8Array;
}
|
AST#method_declaration#Left static async getUint8Array 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#Left defValue ? : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left value = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left KvUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left defValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left value AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async getUint8Array(key: string, defValue?: Uint8Array): Promise<Uint8Array> {
let value = await KvUtil.get(key, defValue);
return value as Uint8Array;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L114-L117
|
2edd86702b471c639675e0cab0c726bf0c65641a
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/shortvideo/Index.ets
|
arkts
|
VideoSwiper
|
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, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { VideoSwiper } from './src/main/ets/utils/VideoSwiper';
|
AST#export_declaration#Left export { VideoSwiper } from './src/main/ets/utils/VideoSwiper' ; AST#export_declaration#Right
|
export { VideoSwiper } from './src/main/ets/utils/VideoSwiper';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/Index.ets#L16-L16
|
6b3c1b6497e8d32c4c940c536c9a354acde3fe9a
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets
|
arkts
|
ChineseToPinyinComponent
|
功能描述: 本示例介绍使用第三方库的pinyin4js组件实现汉字转大写拼音。
推荐场景: 身份信息展示场景
核心组件:
1. 三方库pinyin4js组件
实现步骤:
1. 引入第三方库pinyin4js组件。
2. 使用convertToPinyinString实现汉字转拼音。
|
@Component
export struct ChineseToPinyinComponent {
@State userName: string | Resource = $r('app.string.pinyin_name_content');
// 个人信息分组
@State userGroup: ListConstruction[] = [
new ListConstruction($r('app.string.pinyin_id'), $r('app.string.pinyin_name_change_title'), $r('app.string.pinyin_name_change_content')),
new ListConstruction($r('app.string.pinyin_sex_id'), $r('app.string.pinyin_sex_title'), $r('app.string.pinyin_sex_content'))
];
// 证件信息分组
@State idGroup: ListConstruction[] = [
new ListConstruction($r('app.string.pinyin_country_id'), $r('app.string.pinyin_country_title'), $r('app.string.pinyin_country_content')),
new ListConstruction($r('app.string.pinyin_type_id'), $r('app.string.pinyin_id_type_title'), $r('app.string.pinyin_id_type_content')),
new ListConstruction($r('app.string.pinyin_card_id'), $r('app.string.pinyin_id_title'), $r('app.string.pinyin_id_content')),
new ListConstruction($r('app.string.pinyin_validity_id'), $r('app.string.pinyin_id_validity_title'), $r('app.string.pinyin_id_validity_content'))
];
build() {
Column() {
Text($r('app.string.pinyin_title_content'))
.fontSize($r('app.integer.pinyin_title_font_size'))
.fontColor($r('app.color.pinyin_title_font_color'))
.fontWeight(FontWeight.Bold)
.width($r('app.string.pinyin_title_width'))
.lineHeight($r('app.integer.pinyin_title_line_height'))
.textAlign(TextAlign.Center)
.height($r('app.integer.pinyin_title_height'))
List({
space: LIST_SPACE
}) {
ListItem() {
Row() {
Text($r('app.string.pinyin_name_title'))
.width($r('app.string.pinyin_name_title_width'))
.fontColor($r('app.color.pinyin_list_title_color'))
.fontSize($r('app.integer.pinyin_list_title_size'))
.layoutWeight(LAYOUT_WEIGHT)
.lineHeight($r('app.integer.pinyin_list_line_height'))
TextInput({
text: this.userName
})
.id(INPUT_ID)
.textAlign(TextAlign.End)
.backgroundColor($r('app.color.pinyin_text_input_background'))
.fontSize($r('app.integer.pinyin_list_content_size'))
.layoutWeight(LAYOUT_WEIGHT)
.selectionMenuHidden(true)
.onChange((value: string) => {
/** TODO: 知识点: 使用convertToPinyinString方法将汉字转换成拼音字母。
其中参数1为待转数据,参数2为拼音间隔字符,参数3设置是否带声调符号。
*/
const pinyin: string = pinyin4js.convertToPinyinString(value, '', pinyin4js.WITHOUT_TONE);
this.userGroup[PINYIN_ARRAY].content = pinyin.toUpperCase();
})
}
.height($r('app.integer.pinyin_pinyin_height'))
.borderRadius($r('app.integer.pinyin_list_radius'))
.backgroundColor($r('app.color.pinyin_list_background'))
.margin({
left: $r('app.integer.pinyin_margin_left'),
right: $r('app.integer.pinyin_margin_right')
})
.padding({
left: $r('app.integer.pinyin_padding_left'),
right: $r('app.integer.pinyin_padding_right')
})
}
ListItem() {
ForEachItem({ dataGroup: this.userGroup })
}
.margin({
left: $r('app.integer.pinyin_list_item_margin_left'),
right: $r('app.integer.pinyin_list_item_margin_right')
})
ListItem() {
ForEachItem({ dataGroup: this.idGroup })
}
.margin({
left: $r('app.integer.pinyin_list_item_margin_left'),
right: $r('app.integer.pinyin_list_item_margin_right')
})
}
.width($r('app.string.pinyin_list_width'))
.margin({ top: $r('app.integer.pinyin_list_margin_top') })
Button($r('app.string.pinyin_button_content'))
.width($r('app.string.pinyin_button_width'))
.margin({ top: $r('app.integer.pinyin_button_margin_top') })
.onClick(() => {
promptAction.showToast({ message: $r('app.string.pinyin_only_show') });
})
}
.backgroundColor($r('app.color.pinyin_body_background'))
.height($r('app.string.pinyin_body_height'))
.width($r('app.string.pinyin_body_width'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChineseToPinyinComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right userName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_name_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right // 个人信息分组 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right userGroup : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ListConstruction [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListConstruction AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_id' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_name_change_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_name_change_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListConstruction AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_sex_id' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_sex_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_sex_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 证件信息分组 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right idGroup : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ListConstruction [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListConstruction AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_country_id' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_country_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_country_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListConstruction AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_type_id' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_id_type_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_id_type_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListConstruction AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_card_id' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_id_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_id_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ListConstruction AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_validity_id' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_id_validity_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_id_validity_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right 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_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_title_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_title_font_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pinyin_title_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_title_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_title_line_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_title_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left LIST_SPACE AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_name_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_name_title_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pinyin_list_title_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_title_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left LAYOUT_WEIGHT AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_line_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userName AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left INPUT_ID AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pinyin_text_input_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_content_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left LAYOUT_WEIGHT AST#expression#Right ) AST#modifier_chain_expression#Left . selectionMenuHidden ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { /** TODO: 知识点: 使用convertToPinyinString方法将汉字转换成拼音字母。
其中参数1为待转数据,参数2为拼音间隔字符,参数3设置是否带声调符号。
*/ AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pinyin : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pinyin4js AST#expression#Right . convertToPinyinString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left '' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pinyin4js AST#expression#Right . WITHOUT_TONE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userGroup AST#member_expression#Right AST#expression#Right [ AST#expression#Left PINYIN_ARRAY AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . content AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pinyin AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_pinyin_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pinyin_list_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_margin_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_margin_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_padding_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ForEachItem ( AST#component_parameters#Left { AST#component_parameter#Left dataGroup : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userGroup AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_item_margin_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_item_margin_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ForEachItem ( AST#component_parameters#Left { AST#component_parameter#Left dataGroup : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . idGroup AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_item_margin_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_item_margin_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_list_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_margin_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_button_content' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_button_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_button_margin_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_only_show' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pinyin_body_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_body_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pinyin_body_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct ChineseToPinyinComponent {
@State userName: string | Resource = $r('app.string.pinyin_name_content');
@State userGroup: ListConstruction[] = [
new ListConstruction($r('app.string.pinyin_id'), $r('app.string.pinyin_name_change_title'), $r('app.string.pinyin_name_change_content')),
new ListConstruction($r('app.string.pinyin_sex_id'), $r('app.string.pinyin_sex_title'), $r('app.string.pinyin_sex_content'))
];
@State idGroup: ListConstruction[] = [
new ListConstruction($r('app.string.pinyin_country_id'), $r('app.string.pinyin_country_title'), $r('app.string.pinyin_country_content')),
new ListConstruction($r('app.string.pinyin_type_id'), $r('app.string.pinyin_id_type_title'), $r('app.string.pinyin_id_type_content')),
new ListConstruction($r('app.string.pinyin_card_id'), $r('app.string.pinyin_id_title'), $r('app.string.pinyin_id_content')),
new ListConstruction($r('app.string.pinyin_validity_id'), $r('app.string.pinyin_id_validity_title'), $r('app.string.pinyin_id_validity_content'))
];
build() {
Column() {
Text($r('app.string.pinyin_title_content'))
.fontSize($r('app.integer.pinyin_title_font_size'))
.fontColor($r('app.color.pinyin_title_font_color'))
.fontWeight(FontWeight.Bold)
.width($r('app.string.pinyin_title_width'))
.lineHeight($r('app.integer.pinyin_title_line_height'))
.textAlign(TextAlign.Center)
.height($r('app.integer.pinyin_title_height'))
List({
space: LIST_SPACE
}) {
ListItem() {
Row() {
Text($r('app.string.pinyin_name_title'))
.width($r('app.string.pinyin_name_title_width'))
.fontColor($r('app.color.pinyin_list_title_color'))
.fontSize($r('app.integer.pinyin_list_title_size'))
.layoutWeight(LAYOUT_WEIGHT)
.lineHeight($r('app.integer.pinyin_list_line_height'))
TextInput({
text: this.userName
})
.id(INPUT_ID)
.textAlign(TextAlign.End)
.backgroundColor($r('app.color.pinyin_text_input_background'))
.fontSize($r('app.integer.pinyin_list_content_size'))
.layoutWeight(LAYOUT_WEIGHT)
.selectionMenuHidden(true)
.onChange((value: string) => {
const pinyin: string = pinyin4js.convertToPinyinString(value, '', pinyin4js.WITHOUT_TONE);
this.userGroup[PINYIN_ARRAY].content = pinyin.toUpperCase();
})
}
.height($r('app.integer.pinyin_pinyin_height'))
.borderRadius($r('app.integer.pinyin_list_radius'))
.backgroundColor($r('app.color.pinyin_list_background'))
.margin({
left: $r('app.integer.pinyin_margin_left'),
right: $r('app.integer.pinyin_margin_right')
})
.padding({
left: $r('app.integer.pinyin_padding_left'),
right: $r('app.integer.pinyin_padding_right')
})
}
ListItem() {
ForEachItem({ dataGroup: this.userGroup })
}
.margin({
left: $r('app.integer.pinyin_list_item_margin_left'),
right: $r('app.integer.pinyin_list_item_margin_right')
})
ListItem() {
ForEachItem({ dataGroup: this.idGroup })
}
.margin({
left: $r('app.integer.pinyin_list_item_margin_left'),
right: $r('app.integer.pinyin_list_item_margin_right')
})
}
.width($r('app.string.pinyin_list_width'))
.margin({ top: $r('app.integer.pinyin_list_margin_top') })
Button($r('app.string.pinyin_button_content'))
.width($r('app.string.pinyin_button_width'))
.margin({ top: $r('app.integer.pinyin_button_margin_top') })
.onClick(() => {
promptAction.showToast({ message: $r('app.string.pinyin_only_show') });
})
}
.backgroundColor($r('app.color.pinyin_body_background'))
.height($r('app.string.pinyin_body_height'))
.width($r('app.string.pinyin_body_width'))
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets#L53-L151
|
7e0416e57494b69e66ddd29fa1680701ffa90fcd
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/CryptoHelper.ets
|
arkts
|
getKeyDataBlob
|
获取DataBlob类型的公钥或私钥
@param data 待转换的公钥或私钥。
@param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8),data为字符串时用到
|
static getKeyDataBlob(data: string | Uint8Array | cryptoFramework.DataBlob | null,
keyCoding: crypto.BhuCoding = 'utf-8'): cryptoFramework.DataBlob | null {
if (data === null) {
return null;
} else if (typeof data === 'string') {
return { data: CryptoHelper.strToUint8Array(data, keyCoding) };
} else if (data instanceof Uint8Array) {
return { data: data };
} else {
return data;
}
}
|
AST#method_declaration#Left static getKeyDataBlob AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . BhuCoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'utf-8' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left data AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . strToUint8Array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right instanceof AST#expression#Left Uint8Array AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left data AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left data AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getKeyDataBlob(data: string | Uint8Array | cryptoFramework.DataBlob | null,
keyCoding: crypto.BhuCoding = 'utf-8'): cryptoFramework.DataBlob | null {
if (data === null) {
return null;
} else if (typeof data === 'string') {
return { data: CryptoHelper.strToUint8Array(data, keyCoding) };
} else if (data instanceof Uint8Array) {
return { data: data };
} else {
return data;
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L116-L127
|
66dc1228a2048c8d6d350f102fb1bd194e770ffd
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/CanvasComponent/entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
Common constants for all features.
|
export default class CommonConstants {
/**
* Watermelon image url.
*/
static readonly WATERMELON_IMAGE_URL: string = '../../../resources/base/media/ic_watermelon.png';
/**
* Hamburg image url.
*/
static readonly HAMBURG_IMAGE_URL: string = '../../../resources/base/media/ic_hamburg.png';
/**
* Cake image url.
*/
static readonly CAKE_IMAGE_URL: string = '../../../resources/base/media/ic_cake.png';
/**
* Beer image url.
*/
static readonly BEER_IMAGE_URL: string = '../../../resources/base/media/ic_beer.png';
/**
* Smile image url.
*/
static readonly SMILE_IMAGE_URL: string = '../../../resources/base/media/ic_smile.png';
/**
* Transform angle.
*/
static readonly TRANSFORM_ANGLE: number = -120;
/**
* 360 degrees.
*/
static readonly CIRCLE: number = 360;
/**
* 180 degrees.
*/
static readonly HALF_CIRCLE: number = 180;
/**
* count.
*/
static readonly COUNT: number = 6;
/**
* Small circle count.
*/
static readonly SMALL_CIRCLE_COUNT: number = 8;
/**
* Image size.
*/
static readonly IMAGE_SIZE: number = 40;
/**
* Prize angle.
*/
static readonly ANGLE: number = 270;
/**
* duration.
*/
static readonly DURATION: number = 4000;
/**
* One.
*/
static readonly ONE: number = 1;
/**
* Two.
*/
static readonly TWO: number = 2;
/**
* Three.
*/
static readonly THREE: number = 3;
/**
* Four.
*/
static readonly FOUR: number = 4;
/**
* Five.
*/
static readonly FIVE: number = 5;
/**
* Six.
*/
static readonly SIX: number = 6;
/**
* Flower point y ratios.
*/
static readonly FLOWER_POINT_Y_RATIOS: number = 0.255;
/**
* Flower radius ratios.
*/
static readonly FLOWER_RADIUS_RATIOS: number = 0.217;
/**
* Flower inner radius ratios.
*/
static readonly FLOWER_INNER_RATIOS: number = 0.193;
/**
* Out circle ratios.
*/
static readonly OUT_CIRCLE_RATIOS: number = 0.4;
/**
* Small circle ratios.
*/
static readonly SMALL_CIRCLE_RATIOS: number = 0.378;
/**
* Small circle radius.
*/
static readonly SMALL_CIRCLE_RADIUS: number = 4.1;
/**
* Inner circle ratios.
*/
static readonly INNER_CIRCLE_RATIOS: number = 0.356;
/**
* Inner white circle ratios.
*/
static readonly INNER_WHITE_CIRCLE_RATIOS: number = 0.339;
/**
* Inner arc ratios.
*/
static readonly INNER_ARC_RATIOS: number = 0.336;
/**
* Image dx ratios.
*/
static readonly IMAGE_DX_RATIOS: number = 0.114;
/**
* Image dy ratios.
*/
static readonly IMAGE_DY_RATIOS: number = 0.052;
/**
* Arc text start angle.
*/
static readonly ARC_START_ANGLE: number = 34;
/**
* Arc text end angle.
*/
static readonly ARC_END_ANGLE: number = 26;
/**
* Text align.
*/
static readonly TEXT_ALIGN: CanvasTextAlign = 'center';
/**
* Text base line.
*/
static readonly TEXT_BASE_LINE: CanvasTextBaseline = 'middle';
/**
* Canvas font.
*/
static readonly CANVAS_FONT: string = 'px sans-serif';
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Watermelon image url.
*/ AST#property_declaration#Left static readonly WATERMELON_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_watermelon.png' AST#expression#Right ; AST#property_declaration#Right /**
* Hamburg image url.
*/ AST#property_declaration#Left static readonly HAMBURG_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_hamburg.png' AST#expression#Right ; AST#property_declaration#Right /**
* Cake image url.
*/ AST#property_declaration#Left static readonly CAKE_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_cake.png' AST#expression#Right ; AST#property_declaration#Right /**
* Beer image url.
*/ AST#property_declaration#Left static readonly BEER_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_beer.png' AST#expression#Right ; AST#property_declaration#Right /**
* Smile image url.
*/ AST#property_declaration#Left static readonly SMILE_IMAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '../../../resources/base/media/ic_smile.png' AST#expression#Right ; AST#property_declaration#Right /**
* Transform angle.
*/ AST#property_declaration#Left static readonly TRANSFORM_ANGLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 120 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 360 degrees.
*/ AST#property_declaration#Left static readonly CIRCLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 360 AST#expression#Right ; AST#property_declaration#Right /**
* 180 degrees.
*/ AST#property_declaration#Left static readonly HALF_CIRCLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 180 AST#expression#Right ; AST#property_declaration#Right /**
* count.
*/ AST#property_declaration#Left static readonly COUNT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 6 AST#expression#Right ; AST#property_declaration#Right /**
* Small circle count.
*/ AST#property_declaration#Left static readonly SMALL_CIRCLE_COUNT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right /**
* Image size.
*/ AST#property_declaration#Left static readonly IMAGE_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right ; AST#property_declaration#Right /**
* Prize angle.
*/ AST#property_declaration#Left static readonly ANGLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 270 AST#expression#Right ; AST#property_declaration#Right /**
* duration.
*/ AST#property_declaration#Left static readonly DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4000 AST#expression#Right ; AST#property_declaration#Right /**
* One.
*/ AST#property_declaration#Left static readonly ONE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /**
* Two.
*/ AST#property_declaration#Left static readonly TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /**
* Three.
*/ AST#property_declaration#Left static readonly THREE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right /**
* Four.
*/ AST#property_declaration#Left static readonly FOUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4 AST#expression#Right ; AST#property_declaration#Right /**
* Five.
*/ AST#property_declaration#Left static readonly FIVE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right /**
* Six.
*/ AST#property_declaration#Left static readonly SIX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 6 AST#expression#Right ; AST#property_declaration#Right /**
* Flower point y ratios.
*/ AST#property_declaration#Left static readonly FLOWER_POINT_Y_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.255 AST#expression#Right ; AST#property_declaration#Right /**
* Flower radius ratios.
*/ AST#property_declaration#Left static readonly FLOWER_RADIUS_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.217 AST#expression#Right ; AST#property_declaration#Right /**
* Flower inner radius ratios.
*/ AST#property_declaration#Left static readonly FLOWER_INNER_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.193 AST#expression#Right ; AST#property_declaration#Right /**
* Out circle ratios.
*/ AST#property_declaration#Left static readonly OUT_CIRCLE_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right ; AST#property_declaration#Right /**
* Small circle ratios.
*/ AST#property_declaration#Left static readonly SMALL_CIRCLE_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.378 AST#expression#Right ; AST#property_declaration#Right /**
* Small circle radius.
*/ AST#property_declaration#Left static readonly SMALL_CIRCLE_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4.1 AST#expression#Right ; AST#property_declaration#Right /**
* Inner circle ratios.
*/ AST#property_declaration#Left static readonly INNER_CIRCLE_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.356 AST#expression#Right ; AST#property_declaration#Right /**
* Inner white circle ratios.
*/ AST#property_declaration#Left static readonly INNER_WHITE_CIRCLE_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.339 AST#expression#Right ; AST#property_declaration#Right /**
* Inner arc ratios.
*/ AST#property_declaration#Left static readonly INNER_ARC_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.336 AST#expression#Right ; AST#property_declaration#Right /**
* Image dx ratios.
*/ AST#property_declaration#Left static readonly IMAGE_DX_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.114 AST#expression#Right ; AST#property_declaration#Right /**
* Image dy ratios.
*/ AST#property_declaration#Left static readonly IMAGE_DY_RATIOS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.052 AST#expression#Right ; AST#property_declaration#Right /**
* Arc text start angle.
*/ AST#property_declaration#Left static readonly ARC_START_ANGLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 34 AST#expression#Right ; AST#property_declaration#Right /**
* Arc text end angle.
*/ AST#property_declaration#Left static readonly ARC_END_ANGLE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 26 AST#expression#Right ; AST#property_declaration#Right /**
* Text align.
*/ AST#property_declaration#Left static readonly TEXT_ALIGN : AST#type_annotation#Left AST#primary_type#Left CanvasTextAlign AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'center' AST#expression#Right ; AST#property_declaration#Right /**
* Text base line.
*/ AST#property_declaration#Left static readonly TEXT_BASE_LINE : AST#type_annotation#Left AST#primary_type#Left CanvasTextBaseline AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'middle' AST#expression#Right ; AST#property_declaration#Right /**
* Canvas font.
*/ AST#property_declaration#Left static readonly CANVAS_FONT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'px sans-serif' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class CommonConstants {
static readonly WATERMELON_IMAGE_URL: string = '../../../resources/base/media/ic_watermelon.png';
static readonly HAMBURG_IMAGE_URL: string = '../../../resources/base/media/ic_hamburg.png';
static readonly CAKE_IMAGE_URL: string = '../../../resources/base/media/ic_cake.png';
static readonly BEER_IMAGE_URL: string = '../../../resources/base/media/ic_beer.png';
static readonly SMILE_IMAGE_URL: string = '../../../resources/base/media/ic_smile.png';
static readonly TRANSFORM_ANGLE: number = -120;
static readonly CIRCLE: number = 360;
static readonly HALF_CIRCLE: number = 180;
static readonly COUNT: number = 6;
static readonly SMALL_CIRCLE_COUNT: number = 8;
static readonly IMAGE_SIZE: number = 40;
static readonly ANGLE: number = 270;
static readonly DURATION: number = 4000;
static readonly ONE: number = 1;
static readonly TWO: number = 2;
static readonly THREE: number = 3;
static readonly FOUR: number = 4;
static readonly FIVE: number = 5;
static readonly SIX: number = 6;
static readonly FLOWER_POINT_Y_RATIOS: number = 0.255;
static readonly FLOWER_RADIUS_RATIOS: number = 0.217;
static readonly FLOWER_INNER_RATIOS: number = 0.193;
static readonly OUT_CIRCLE_RATIOS: number = 0.4;
static readonly SMALL_CIRCLE_RATIOS: number = 0.378;
static readonly SMALL_CIRCLE_RADIUS: number = 4.1;
static readonly INNER_CIRCLE_RATIOS: number = 0.356;
static readonly INNER_WHITE_CIRCLE_RATIOS: number = 0.339;
static readonly INNER_ARC_RATIOS: number = 0.336;
static readonly IMAGE_DX_RATIOS: number = 0.114;
static readonly IMAGE_DY_RATIOS: number = 0.052;
static readonly ARC_START_ANGLE: number = 34;
static readonly ARC_END_ANGLE: number = 26;
static readonly TEXT_ALIGN: CanvasTextAlign = 'center';
static readonly TEXT_BASE_LINE: CanvasTextBaseline = 'middle';
static readonly CANVAS_FONT: string = 'px sans-serif';
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/CanvasComponent/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L194
|
985a109bd0ae16c0f53593005a20fde1b968a4ae
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
完整农历系统设计.ets
|
arkts
|
createLunarDateInfo
|
创建农历日期信息对象
|
private static createLunarDateInfo(year: number, month: number, day: number, isLeapMonth: boolean, yearConfig: LunarYearConfig): LunarDateInfo {
return {
year: year,
month: month,
day: day,
isLeapMonth: isLeapMonth,
yearCn: NewLunarCalendar.getLunarYearCn(year),
monthCn: NewLunarCalendar.getLunarMonthCn(month, isLeapMonth),
dayCn: NewLunarCalendar.getLunarDayCn(day),
gzYear: yearConfig.gzYear,
gzMonth: NewLunarCalendar.getGanZhi((year - 1900) * 12 + month + 12),
gzDay: NewLunarCalendar.getGanZhi(NewLunarCalendar.getDayOffset(new Date())),
zodiac: yearConfig.zodiac,
yearNameCn: yearConfig.yearNameCn,
totalDaysInYear: yearConfig.totalDays
};
}
|
AST#method_declaration#Left private static createLunarDateInfo AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLeapMonth : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left yearConfig : AST#type_annotation#Left AST#primary_type#Left LunarYearConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LunarDateInfo AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left year AST#property_name#Right : AST#expression#Left year AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left month AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left day AST#property_name#Right : AST#expression#Left day AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isLeapMonth AST#property_name#Right : AST#expression#Left isLeapMonth AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left yearCn AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NewLunarCalendar AST#expression#Right . getLunarYearCn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left monthCn AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NewLunarCalendar AST#expression#Right . getLunarMonthCn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left month AST#expression#Right , AST#expression#Left isLeapMonth AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dayCn AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NewLunarCalendar AST#expression#Right . getLunarDayCn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left day AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gzYear AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left yearConfig AST#expression#Right . gzYear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gzMonth AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NewLunarCalendar AST#expression#Right . getGanZhi AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left year AST#expression#Right - AST#expression#Left 1900 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left month AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 12 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gzDay AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NewLunarCalendar AST#expression#Right . getGanZhi AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NewLunarCalendar AST#expression#Right . getDayOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left zodiac AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left yearConfig AST#expression#Right . zodiac AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left yearNameCn AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left yearConfig AST#expression#Right . yearNameCn AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalDaysInYear AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left yearConfig AST#expression#Right . totalDays AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static createLunarDateInfo(year: number, month: number, day: number, isLeapMonth: boolean, yearConfig: LunarYearConfig): LunarDateInfo {
return {
year: year,
month: month,
day: day,
isLeapMonth: isLeapMonth,
yearCn: NewLunarCalendar.getLunarYearCn(year),
monthCn: NewLunarCalendar.getLunarMonthCn(month, isLeapMonth),
dayCn: NewLunarCalendar.getLunarDayCn(day),
gzYear: yearConfig.gzYear,
gzMonth: NewLunarCalendar.getGanZhi((year - 1900) * 12 + month + 12),
gzDay: NewLunarCalendar.getGanZhi(NewLunarCalendar.getDayOffset(new Date())),
zodiac: yearConfig.zodiac,
yearNameCn: yearConfig.yearNameCn,
totalDaysInYear: yearConfig.totalDays
};
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L378-L394
|
5307f74d71ae14230e33eb6a91e2e2faaaad4012
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/model/src/main/ets/entity/SelectedGoods.ets
|
arkts
|
@param {Partial<SelectedGoods>} init - 初始化数据
|
constructor(init?: Partial<SelectedGoods>) {
if (!init) {
return;
}
this.goodsId = init.goodsId ?? this.goodsId;
this.goodsInfo = init.goodsInfo ?? this.goodsInfo;
this.spec = init.spec ?? this.spec;
this.count = init.count ?? this.count;
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SelectedGoods AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left init AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right 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 . goodsId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . goodsInfo AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsInfo AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . spec AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . spec AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . spec AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . count AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . count AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . count AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(init?: Partial<SelectedGoods>) {
if (!init) {
return;
}
this.goodsId = init.goodsId ?? this.goodsId;
this.goodsInfo = init.goodsInfo ?? this.goodsInfo;
this.spec = init.spec ?? this.spec;
this.count = init.count ?? this.count;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/SelectedGoods.ets#L31-L39
|
3e4725bb7d5614f0e03b54ec1d297a6c314519d5
|
github
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/components/AxisBase.ets
|
arkts
|
getValueFormatter
|
Returns the formatter used for formatting the axis labels.
@return
|
public getValueFormatter(): IAxisValueFormatter {
if (!this.mAxisValueFormatter ||
(this.mAxisValueFormatter instanceof DefaultAxisValueFormatter &&
(this.mAxisValueFormatter as DefaultAxisValueFormatter).getDecimalDigits() != this.mDecimals))
this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals);
return this.mAxisValueFormatter;
}
|
AST#method_declaration#Left public getValueFormatter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IAxisValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . mAxisValueFormatter AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisValueFormatter AST#member_expression#Right AST#expression#Right instanceof AST#expression#Left DefaultAxisValueFormatter AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisValueFormatter AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left DefaultAxisValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . getDecimalDigits AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right != AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mDecimals AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) 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 . mAxisValueFormatter AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DefaultAxisValueFormatter AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDecimals AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisValueFormatter AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getValueFormatter(): IAxisValueFormatter {
if (!this.mAxisValueFormatter ||
(this.mAxisValueFormatter instanceof DefaultAxisValueFormatter &&
(this.mAxisValueFormatter as DefaultAxisValueFormatter).getDecimalDigits() != this.mDecimals))
this.mAxisValueFormatter = new DefaultAxisValueFormatter(this.mDecimals);
return this.mAxisValueFormatter;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L566-L574
|
ab141f4af1c4aa062dce8de3a3aecc776e166506
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
代理配置接口
|
export interface ProxyConfig {
host: string;
port: number;
username?: string;
password?: string;
type: 'http' | 'https' | 'socks5';
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ProxyConfig AST#object_type#Left { AST#type_member#Left host : 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 port : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left username ? : 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 password ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#ERROR#Left type : 'http' | 'https' | 'socks5' ; AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ProxyConfig {
host: string;
port: number;
username?: string;
password?: string;
type: 'http' | 'https' | 'socks5';
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L464-L470
|
0dbd2af0573ef8e36d9a054a128ce502b90063d1
|
github
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/DESSync.ets
|
arkts
|
encodeCBC
|
加密-CBC模式
@param str 待加密的字符串
@param aesKey 3DES密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64
@returns
|
static encodeCBC(str: string, desKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, resultCoding);
}
|
AST#method_declaration#Left static encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left desKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . encodeCBC AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left desKey AST#expression#Right , AST#expression#Left iv AST#expression#Right , AST#expression#Left '3DES192' AST#expression#Right , AST#expression#Left '3DES192|CBC|PKCS7' AST#expression#Right , AST#expression#Left 192 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static encodeCBC(str: string, desKey: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, desKey, iv, '3DES192', '3DES192|CBC|PKCS7', 192, keyCoding, resultCoding);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/DESSync.ets#L60-L63
|
29c013b88ae5b32ddf66c251d6ba9704d235b527
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/model/src/main/ets/entity/GoodsSpec.ets
|
arkts
|
@file 规格模型
@author Joker.X
|
export class GoodsSpec {
/**
* ID
*/
id: number = 0;
/**
* 商品ID
*/
goodsId: number = 0;
/**
* 名称
*/
name: string = "";
/**
* 价格
*/
price: number = 0;
/**
* 库存
*/
stock: number = 0;
/**
* 排序
*/
sortNum: number = 0;
/**
* 图片
*/
images?: string[] | null = null;
/**
* 创建时间
*/
createTime?: string | null = null;
/**
* 更新时间
*/
updateTime?: string | null = null;
constructor(init?: Partial<GoodsSpec>) {
if (!init) {
return;
}
this.id = init.id ?? this.id;
this.goodsId = init.goodsId ?? this.goodsId;
this.name = init.name ?? this.name;
this.price = init.price ?? this.price;
this.stock = init.stock ?? this.stock;
this.sortNum = init.sortNum ?? this.sortNum;
this.images = init.images ?? this.images;
this.createTime = init.createTime ?? this.createTime;
this.updateTime = init.updateTime ?? this.updateTime;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class GoodsSpec AST#class_body#Left { /**
* ID
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /**
* 商品ID
*/ AST#property_declaration#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /**
* 名称
*/ AST#property_declaration#Left name : 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 /**
* 价格
*/ AST#property_declaration#Left price : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /**
* 库存
*/ AST#property_declaration#Left stock : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /**
* 排序
*/ AST#property_declaration#Left sortNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right /**
* 图片
*/ AST#property_declaration#Left images ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 创建时间
*/ AST#property_declaration#Left createTime ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 更新时间
*/ AST#property_declaration#Left updateTime ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GoodsSpec AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left init AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right 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 . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . goodsId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . goodsId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . name AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . name AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . price AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . price AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . price AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . stock AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . stock AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . stock AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . sortNum AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . sortNum AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . sortNum AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . images AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . images AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . images AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . createTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . createTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . createTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . updateTime AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . updateTime AST#member_expression#Right AST#expression#Right ?? AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . updateTime AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class GoodsSpec {
id: number = 0;
goodsId: number = 0;
name: string = "";
price: number = 0;
stock: number = 0;
sortNum: number = 0;
images?: string[] | null = null;
createTime?: string | null = null;
updateTime?: string | null = null;
constructor(init?: Partial<GoodsSpec>) {
if (!init) {
return;
}
this.id = init.id ?? this.id;
this.goodsId = init.goodsId ?? this.goodsId;
this.name = init.name ?? this.name;
this.price = init.price ?? this.price;
this.stock = init.stock ?? this.stock;
this.sortNum = init.sortNum ?? this.sortNum;
this.images = init.images ?? this.images;
this.createTime = init.createTime ?? this.createTime;
this.updateTime = init.updateTime ?? this.updateTime;
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/GoodsSpec.ets#L5-L57
|
b948bad8411deccc571d9b04bf2b95800787042f
|
github
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.util.d.ets
|
arkts
|
isArrayBuffer
|
Check whether the entered value is of arraybuffer type.
@param { Object } value - A arraybuffer value
@returns { boolean } Returns true if the value is a built-in ArrayBuffer instance.
This does not include SharedArrayBuffer instances.
Usually, it is desirable to test for both; See isAnyArrayBuffer() for that.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20
|
isArrayBuffer(value: Object): boolean;
|
AST#method_declaration#Left isArrayBuffer AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
isArrayBuffer(value: Object): boolean;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1158-L1158
|
446fe83d4ffa4e9c27ed64a079b485b2713e21d9
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/crypto/RSA.ets
|
arkts
|
recover
|
对数据进行签名恢复原始数据,异步,目前仅RSA支持
@param signData 已签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA1024|PKCS1|NoHash|OnlySign、RSA1024|PKCS1|NoHash|Recover、等)。
@returns
|
static async recover(signData: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|NoHash|Recover'): Promise<cryptoFramework.DataBlob | null> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let rawSignData = await verifier.recover(signData);
return rawSignData;
}
|
AST#method_declaration#Left static async recover AST#parameter_list#Left ( AST#parameter#Left signData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : 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#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'RSA1024|PKCS1|NoHash|Recover' AST#expression#Right AST#parameter#Right ) 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#union_type#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left verifier = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createVerify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left algName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left verifier AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rawSignData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left verifier AST#expression#Right AST#await_expression#Right AST#expression#Right . recover AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left signData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left rawSignData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async recover(signData: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'RSA1024|PKCS1|NoHash|Recover'): Promise<cryptoFramework.DataBlob | null> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let rawSignData = await verifier.recover(signData);
return rawSignData;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L338-L343
|
b52ac9dfe02e90722c3414c51f0d91764174714b
|
gitee
|
zhonghaojie/ArkTSComponentPractice.git
|
73f56243f10439a872d0990320bb3f8df17d0001
|
entry/src/main/ets/pages/Login.ets
|
arkts
|
inputStyle
|
输入框样式
|
@Extend(TextInput) function inputStyle () {
.placeholderColor($r('app.color.placeholder_color'))
.height($r('app.float.login_input_height'))
.fontSize($r('app.float.big_text_size'))
.backgroundColor($r('app.color.background'))
.width('100%')
.padding({ left: 0 })
.margin({ top: $r('app.float.input_margin_top') })
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left TextInput AST#expression#Right ) AST#decorator#Right function inputStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . placeholderColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.placeholder_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.login_input_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.big_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.input_margin_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
|
@Extend(TextInput) function inputStyle () {
.placeholderColor($r('app.color.placeholder_color'))
.height($r('app.float.login_input_height'))
.fontSize($r('app.float.big_text_size'))
.backgroundColor($r('app.color.background'))
.width('100%')
.padding({ left: 0 })
.margin({ top: $r('app.float.input_margin_top') })
}
|
https://github.com/zhonghaojie/ArkTSComponentPractice.git/blob/73f56243f10439a872d0990320bb3f8df17d0001/entry/src/main/ets/pages/Login.ets#L8-L16
|
29b3105f9715a90c7a5db861e9931d6a4cc52a7c
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/ContactTypes.ets
|
arkts
|
联系人导入数据接口
|
export interface ContactImportData {
name: string;
relation?: string;
birthday?: string;
birthdayYear?: number | string; // 出生年份
birthdayMonth?: number | string; // 出生月份
birthdayDay?: number | string; // 出生日期
isLunar?: boolean | string;
age?: number | string; // 年龄(用于农历生日)
gender?: string;
phone?: string;
email?: string;
tags?: string | string[];
notes?: string;
intimacyLevel?: number | string;
// 扩展属性
interests?: string | string[];
dislikes?: string | string[];
favoriteFoods?: string | string[];
taboos?: string | string[];
occupation?: string;
company?: string;
department?: string;
position?: string;
address?: string;
socialMedia?: string | Record<string, string>;
customAttributes?: string | CustomAttribute[];
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactImportData AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left relation ? : 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 birthday ? : 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 birthdayYear ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; // 出生年份 AST#type_member#Left birthdayMonth ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; // 出生月份 AST#type_member#Left birthdayDay ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; // 出生日期 AST#type_member#Left isLunar ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left age ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; // 年龄(用于农历生日) AST#type_member#Left gender ? : 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 phone ? : 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 email ? : 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 tags ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left notes ? : 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 intimacyLevel ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; // 扩展属性 AST#type_member#Left interests ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left dislikes ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left favoriteFoods ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left taboos ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left occupation ? : 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 company ? : 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 department ? : 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 position ? : 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 address ? : 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 socialMedia ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left customAttributes ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left CustomAttribute [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ContactImportData {
name: string;
relation?: string;
birthday?: string;
birthdayYear?: number | string;
birthdayMonth?: number | string;
birthdayDay?: number | string;
isLunar?: boolean | string;
age?: number | string;
gender?: string;
phone?: string;
email?: string;
tags?: string | string[];
notes?: string;
intimacyLevel?: number | string;
interests?: string | string[];
dislikes?: string | string[];
favoriteFoods?: string | string[];
taboos?: string | string[];
occupation?: string;
company?: string;
department?: string;
position?: string;
address?: string;
socialMedia?: string | Record<string, string>;
customAttributes?: string | CustomAttribute[];
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L254-L281
|
7212949db17e70b0ca124dac447d033897c85ff1
|
github
|
|
Active-hue/ArkTS-Accounting.git
|
c432916d305b407557f08e35017c3fd70668e441
|
entry/src/main/ets/common/BillData.ets
|
arkts
|
账单数据模型
|
export interface BillItem {
id: string; // 唯一ID
type: number; // 0: 支出, 1: 收入
amount: string; // 金额
category: string; // 分类
categoryIcon: string; // 分类图标编号
remark: string; // 备注
date: string; // 日期
time: string; // 时间
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface BillItem 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 ; // 唯一ID AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 0: 支出, 1: 收入 AST#type_member#Left amount : 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 category : 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 categoryIcon : 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 remark : 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 date : 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 time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 时间 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface BillItem {
id: string;
type: number;
amount: string;
category: string;
categoryIcon: string; 图标编号
remark: string;
date: string;
time: string;
}
|
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/BillData.ets#L3-L12
|
666580d96d0080fbf30a962704c3fd39c1c67424
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Row.ets
|
arkts
|
RowSpaceAroundTop
|
横向环绕分布 + 垂直顶部
|
@ComponentV2
export struct RowSpaceAroundTop {
/**
* Row 构造参数
*/
@Param
options: RowOptions | RowOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
sizeValue: SizeOptions | undefined = undefined;
/**
* 内边距
*/
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
/**
* 外边距
*/
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
/**
* 是否填充最大宽高
*/
@Param
fillMaxSize: boolean = false;
/**
* 背景颜色
*/
@Param
bgColor: ResourceColor | undefined = undefined;
/**
* 点击事件
*/
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
/**
* 内容构建函数
*/
@BuilderParam
content: CustomBuilder;
/**
* 渲染布局
* @returns {void} 无返回值
* @example
* RowSpaceAroundTop() { Text("A"); Text("B"); Text("C"); }
*/
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceAroundTop AST#component_body#Left { /**
* Row 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RowOptions AST#primary_type#Right | AST#primary_type#Left RowOptionsV2 AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 宽度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right widthValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 高度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right heightValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 尺寸(对应官方 size 属性)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right sizeValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SizeOptions AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right paddingValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedPadding AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 外边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right marginValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Margin AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedMargin AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 是否填充最大宽高
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right fillMaxSize : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 背景颜色
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bgColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 点击事件
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内容构建函数
*/ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 渲染布局
* @returns {void} 无返回值
* @example
* RowSpaceAroundTop() { Text("A"); Text("B"); Text("C"); }
*/ 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#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceAround AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct RowSpaceAroundTop {
@Param
options: RowOptions | RowOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
@Param
fillMaxSize: boolean = false;
@Param
bgColor: ResourceColor | undefined = undefined;
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
@BuilderParam
content: CustomBuilder;
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1265-L1340
|
b412c74e6811aa17e8138cab1ed18273a2c1bcb9
|
github
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/modules/auth/AuthService.ets
|
arkts
|
loginWithBiometric
|
生物识别登录(指纹/面容)
|
async loginWithBiometric(): Promise<boolean> {
try {
Logger.info('AuthService', 'Biometric login attempt');
// Mock 生物识别登录
// 实际实现需要使用 @ohos.userIAM.userAuth API
const token = await StorageManager.getString(this.TOKEN_KEY, '');
if (token) {
// 如果已有token,直接使用
const userInfoStr = await StorageManager.getString(this.USER_INFO_KEY, '');
if (userInfoStr) {
this.currentUser = JSON.parse(userInfoStr) as UserInfo;
EventBus.emit('LOGIN_SUCCESS', { userId: this.currentUser.id, username: this.currentUser.username });
Logger.info('AuthService', 'Biometric login successful');
return true;
}
}
return false;
} catch (error) {
Logger.error('AuthService', `Biometric login failed: ${String(error)}`);
return false;
}
}
|
AST#method_declaration#Left async loginWithBiometric 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AuthService' AST#expression#Right , AST#expression#Left 'Biometric login attempt' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Mock 生物识别登录 // 实际实现需要使用 @ohos.userIAM.userAuth API AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left token = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TOKEN_KEY AST#member_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left token AST#expression#Right ) AST#block_statement#Left { // 如果已有token,直接使用 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left userInfoStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left StorageManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . USER_INFO_KEY AST#member_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left userInfoStr AST#expression#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 . currentUser AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userInfoStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBus AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'LOGIN_SUCCESS' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left userId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentUser AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left username AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentUser AST#member_expression#Right AST#expression#Right . username AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AuthService' AST#expression#Right , AST#expression#Left 'Biometric login successful' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AuthService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Biometric login failed: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async loginWithBiometric(): Promise<boolean> {
try {
Logger.info('AuthService', 'Biometric login attempt');
const token = await StorageManager.getString(this.TOKEN_KEY, '');
if (token) {
const userInfoStr = await StorageManager.getString(this.USER_INFO_KEY, '');
if (userInfoStr) {
this.currentUser = JSON.parse(userInfoStr) as UserInfo;
EventBus.emit('LOGIN_SUCCESS', { userId: this.currentUser.id, username: this.currentUser.username });
Logger.info('AuthService', 'Biometric login successful');
return true;
}
}
return false;
} catch (error) {
Logger.error('AuthService', `Biometric login failed: ${String(error)}`);
return false;
}
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L326-L350
|
736bd177caef161f96ab348c33cffe88e7790a98
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets
|
arkts
|
failureCallback
|
This parameter is used to report error information when an error occurs in function invoking.
@param error Error information.
|
failureCallback(error: Error) {
Logger.error(`[HomeDialogModel] error happened: ` + JSON.stringify(error));
this.showPrompt($r('app.string.link_check_fail'));
}
|
AST#method_declaration#Left failureCallback AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left Error 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` [HomeDialogModel] error happened: ` AST#template_literal#Right AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right 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 . showPrompt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.link_check_fail' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
failureCallback(error: Error) {
Logger.error(`[HomeDialogModel] error happened: ` + JSON.stringify(error));
this.showPrompt($r('app.string.link_check_fail'));
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets#L130-L133
|
2c8db1c29fb386ae7b326965e870a1796dcf4f28
|
gitee
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/entry/src/main/ets/pages/class.ets
|
arkts
|
getShowContent
|
**********获取课程信息网络**********//
|
async getShowContent() {
let httpRequest = http.createHttp();
let encodedClass = encodeURIComponent(this.courseId); // 编码中文
let url = address.IP + `/getSingleCourse?id=${encodedClass}`;
try {
let response = await httpRequest.request(url, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.token}`
}
});
let result = JSON.parse(response.result as string) as classNetWorkType;
if (result.code === 200) {
this.datas = result.data;
this.isShowTitle = true;
}
} catch (e) {
promptAction.showToast({ message: "网络错误" })
}
}
|
AST#method_declaration#Left async getShowContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encodedClass = AST#expression#Left AST#call_expression#Left AST#expression#Left encodeURIComponent AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . courseId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 编码中文 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left url = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left address AST#expression#Right . IP AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#template_literal#Left ` /getSingleCourse?id= AST#template_substitution#Left $ { AST#expression#Left encodedClass AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left response = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'Authorization' AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` Bearer AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . token AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left classNetWorkType AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#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 . datas AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . isShowTitle AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left "网络错误" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getShowContent() {
let httpRequest = http.createHttp();
let encodedClass = encodeURIComponent(this.courseId);
let url = address.IP + `/getSingleCourse?id=${encodedClass}`;
try {
let response = await httpRequest.request(url, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${this.token}`
}
});
let result = JSON.parse(response.result as string) as classNetWorkType;
if (result.code === 200) {
this.datas = result.data;
this.isShowTitle = true;
}
} catch (e) {
promptAction.showToast({ message: "网络错误" })
}
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/class.ets#L450-L470
|
2a29d982bdbe8de06fae023e2f8e2c417c3d8c28
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/launch/src/main/ets/navigation/SplashNav.ets
|
arkts
|
SplashNav
|
@file 启动页导航入口
@returns {void} 无返回值
@author Joker.X
|
@Builder
export function SplashNav(): void {
SplashPage();
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SplashNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left SplashPage ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function SplashNav(): void {
SplashPage();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/navigation/SplashNav.ets#L8-L11
|
e5a5db73857fe980367f243aa046a65ae44cee02
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets
|
arkts
|
connectSocket
|
连接Socket
@param address
@param port
|
async connectSocket(address: string, port: number): Promise<boolean> {
Logger.info(`${TAG} tcp connectSocket address: ${address}`);
try {
if (!this.tcpSocket) {
return false;
}
if (await this.isConnected()) {
Logger.info(`${TAG} tcp connectSocket sucess`);
return true;
}
await this.tcpSocket.connect({
address: {
address: address,
port: port,
family: 1,
},
timeout: 6000,
});
await this.tcpSocket.setExtraOptions({});
Logger.info(`${TAG} tcp connectSocket sucess`);
return true;
} catch (e) {
Logger.error(`${TAG} tcp connectSocket error ${JSON.stringify(e)}}`);
}
return false;
}
|
AST#method_declaration#Left async connectSocket AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tcp connectSocket address: AST#template_substitution#Left $ { AST#expression#Left address AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . tcpSocket AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . isConnected AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tcp connectSocket sucess ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . tcpSocket AST#member_expression#Right AST#expression#Right . connect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left address AST#property_name#Right : AST#expression#Left address AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left port AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left family AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left 6000 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . tcpSocket AST#member_expression#Right AST#expression#Right . setExtraOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tcp connectSocket sucess ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left TAG AST#expression#Right } AST#template_substitution#Right tcp connectSocket error AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right } ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async connectSocket(address: string, port: number): Promise<boolean> {
Logger.info(`${TAG} tcp connectSocket address: ${address}`);
try {
if (!this.tcpSocket) {
return false;
}
if (await this.isConnected()) {
Logger.info(`${TAG} tcp connectSocket sucess`);
return true;
}
await this.tcpSocket.connect({
address: {
address: address,
port: port,
family: 1,
},
timeout: 6000,
});
await this.tcpSocket.setExtraOptions({});
Logger.info(`${TAG} tcp connectSocket sucess`);
return true;
} catch (e) {
Logger.error(`${TAG} tcp connectSocket error ${JSON.stringify(e)}}`);
}
return false;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets#L57-L83
|
436dc2695c0510e4d8b052c12eae982fe69090ba
|
gitee
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/TabsView.ets
|
arkts
|
TabsView
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Component
export struct TabsView {
@State fontColor: string = '#182431';
@State selectedFontColor: string = '#007DFF';
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
@Link _position: Position;
private componentKey: string = '';
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(16)
.fontWeight(this.currentIndex === index ? 500 : 400)
.lineHeight(22)
.margin({ top: 17, bottom: 7 })
Divider()
.strokeWidth(2)
.color('#007DFF')
.opacity(this.currentIndex === index ? 1 : 0)
}.width('100%')
}
build() {
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#00CB87')
}.tabBar(this.TabBuilder(0, 'green'))
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#007DFF')
}.tabBar(this.TabBuilder(1, 'blue'))
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#FFBF00')
}.tabBar(this.TabBuilder(2, 'yellow'))
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#E67C92')
}.tabBar(this.TabBuilder(3, 'pink'))
}
.vertical(false)
.barMode(BarMode.Fixed)
.barWidth(360)
.barHeight(56)
.animationDuration(400)
.onChange((index: number) => {
this.currentIndex = index
})
.width(360)
.height(296)
.backgroundColor('#F1F3F5')
.position(this._position)
.key(this.componentKey)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabsView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fontColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#182431' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectedFontColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#007DFF' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left TabsController AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TabsController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private componentKey : 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 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left name AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedFontColor AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 500 AST#expression#Right : AST#expression#Left 400 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 17 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 7 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#007DFF' AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Tabs ( AST#component_parameters#Left { AST#component_parameter#Left barPosition : AST#expression#Left AST#member_expression#Left AST#expression#Left BarPosition AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#00CB87' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . tabBar ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TabBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 'green' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#007DFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . tabBar ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TabBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 'blue' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFBF00' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . tabBar ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TabBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left 'yellow' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#E67C92' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . tabBar ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TabBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 3 AST#expression#Right , AST#expression#Left 'pink' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . barMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarMode AST#expression#Right . Fixed AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . barWidth ( AST#expression#Left 360 AST#expression#Right ) AST#modifier_chain_expression#Left . barHeight ( AST#expression#Left 56 AST#expression#Right ) AST#modifier_chain_expression#Left . animationDuration ( AST#expression#Left 400 AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 . currentIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 360 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 296 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F1F3F5' AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _position AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentKey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct TabsView {
@State fontColor: string = '#182431';
@State selectedFontColor: string = '#007DFF';
@State currentIndex: number = 0;
private controller: TabsController = new TabsController();
@Link _position: Position;
private componentKey: string = '';
@Builder TabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize(16)
.fontWeight(this.currentIndex === index ? 500 : 400)
.lineHeight(22)
.margin({ top: 17, bottom: 7 })
Divider()
.strokeWidth(2)
.color('#007DFF')
.opacity(this.currentIndex === index ? 1 : 0)
}.width('100%')
}
build() {
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#00CB87')
}.tabBar(this.TabBuilder(0, 'green'))
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#007DFF')
}.tabBar(this.TabBuilder(1, 'blue'))
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#FFBF00')
}.tabBar(this.TabBuilder(2, 'yellow'))
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor('#E67C92')
}.tabBar(this.TabBuilder(3, 'pink'))
}
.vertical(false)
.barMode(BarMode.Fixed)
.barWidth(360)
.barHeight(56)
.animationDuration(400)
.onChange((index: number) => {
this.currentIndex = index
})
.width(360)
.height(296)
.backgroundColor('#F1F3F5')
.position(this._position)
.key(this.componentKey)
}
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/TabsView.ets#L16-L84
|
880dd16dea8a3ddbd60c16d9e0d3d9ceeea09130
|
gitee
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/entry/src/main/ets/pages/Index.ets
|
arkts
|
JumpToResApiExample
|
订阅事件回调
|
function JumpToResApiExample (err: BusinessError, data: CommonEventManager.CommonEventData) {
if (err) {
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
router.pushUrl({ url: 'pages/BasicResources' });
}
}
|
AST#function_declaration#Left function JumpToResApiExample 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 data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left CommonEventManager . CommonEventData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` subscribe failed, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left 'pages/BasicResources' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function JumpToResApiExample (err: BusinessError, data: CommonEventManager.CommonEventData) {
if (err) {
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
router.pushUrl({ url: 'pages/BasicResources' });
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/BackgroundTaskManagement/ResourceManager/entry/src/main/ets/pages/Index.ets#L25-L31
|
ea84fb3afbdea7e2240cd8431ea2ff27388a7aec
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/device/HoverEffect.ets
|
arkts
|
HoverEffectSample
|
[Start mouse_hover_effect]
|
@Entry
@Component
export struct HoverEffectSample {
@State buttonText: string = '';
@State columnText: string = '';
@State hoverText: string = 'Not Hover';
@State color: Color = Color.Gray;
build() {
NavDestination() {
Column({ space: 12 }) {
Column({ space: 10 }) {
Button('Auto')
.width(170).height(70)
Button('Scale')
.width(170).height(70)
.hoverEffect(HoverEffect.Scale)
Button('Highlight')
.width(170).height(70)
.hoverEffect(HoverEffect.Highlight)
Button('None')
.width(170).height(70)
.hoverEffect(HoverEffect.None)
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.HoverEffectSample_title'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct HoverEffectSample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonText : 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 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right columnText : 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 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right hoverText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Not Hover' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right color : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'Auto' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 170 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 70 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'Scale' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 170 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 70 AST#expression#Right ) AST#modifier_chain_expression#Left . hoverEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left HoverEffect AST#expression#Right . Scale AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'Highlight' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 170 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 70 AST#expression#Right ) AST#modifier_chain_expression#Left . hoverEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left HoverEffect AST#expression#Right . Highlight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'None' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 170 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 70 AST#expression#Right ) AST#modifier_chain_expression#Left . hoverEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left HoverEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.HoverEffectSample_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Entry
@Component
export struct HoverEffectSample {
@State buttonText: string = '';
@State columnText: string = '';
@State hoverText: string = 'Not Hover';
@State color: Color = Color.Gray;
build() {
NavDestination() {
Column({ space: 12 }) {
Column({ space: 10 }) {
Button('Auto')
.width(170).height(70)
Button('Scale')
.width(170).height(70)
.hoverEffect(HoverEffect.Scale)
Button('Highlight')
.width(170).height(70)
.hoverEffect(HoverEffect.Highlight)
Button('None')
.width(170).height(70)
.hoverEffect(HoverEffect.None)
}.width('100%').height('100%').justifyContent(FlexAlign.Center)
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.HoverEffectSample_title'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/device/HoverEffect.ets#L17-L51
|
feadc1f5fa72926e9e373d4ad800c67deee0c3cd
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
picker_utils/src/main/ets/Utils.ets
|
arkts
|
isEmpty
|
判断字符串是否为空(undefined、null、字符串长度为0)
@param str 被检测的字符串
@return 是否为空
|
static isEmpty(str: string | undefined | null): boolean {
return str === undefined || str === null || str.length === 0;
}
|
AST#method_declaration#Left static isEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left str AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left str AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left str AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isEmpty(str: string | undefined | null): boolean {
return str === undefined || str === null || str.length === 0;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L32-L34
|
5fcd9c27d8e207265fe735c56dcc4fcd790311a5
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/contacts/ContactImportPage.ets
|
arkts
|
buildJsonImportSection
|
构建JSON导入区域
|
@Builder
buildJsonImportSection() {
Column({ space: 16 }) {
// 说明
this.buildJsonInstructions()
// JSON内容输入
this.buildJsonInput()
// 解析预览
if (this.showJsonPreview) {
this.buildJsonPreview()
}
// 导入按钮
this.buildImportButton('JSON')
}
.width('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildJsonImportSection 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_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_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 . buildJsonInstructions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // JSON内容输入 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 . buildJsonInput AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 解析预览 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showJsonPreview AST#member_expression#Right AST#expression#Right ) { 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 . buildJsonPreview AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 导入按钮 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 . buildImportButton AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'JSON' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildJsonImportSection() {
Column({ space: 16 }) {
this.buildJsonInstructions()
this.buildJsonInput()
if (this.showJsonPreview) {
this.buildJsonPreview()
}
this.buildImportButton('JSON')
}
.width('100%')
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L138-L156
|
8623d00b3cb3b14031755c925e3331f5b3c24e70
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto/src/main/ets/crypto/encryption/RSASync.ets
|
arkts
|
generateRSAKey
|
生成RSA的非对称密钥
@param resultCoding 生成RSA秘钥的字符串格式(hex/base64)-默认不传为base64格式
@returns RSA密钥{publicKey:公钥,privateKey:私钥}
|
static generateRSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey {
return CryptoSyncUtil.generateCryptoKey('RSA1024', resultCoding);
}
|
AST#method_declaration#Left static generateRSAKey AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CryptoKey AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . generateCryptoKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'RSA1024' AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static generateRSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey {
return CryptoSyncUtil.generateCryptoKey('RSA1024', resultCoding);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L35-L37
|
069fe11547afed00a4d7ba0c10ebefce6b6ca897
|
gitee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.