Merge pull request !362 from Andrey Smykov/lambda_types
This commit is contained in:
openharmony_ci 2023-06-08 02:41:18 +00:00 committed by Gitee
commit 47e1abb575
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
67 changed files with 371 additions and 377 deletions

View File

@ -62,17 +62,17 @@ export struct ImageGridItemComponent {
Log.info(TAG, "getThumbnail1 " + this.thumbnail);
if (this.mediaItem.isLoad()) {
this.thumbnail = this.mediaItem.getThumbnail(MediaConstants.DEFAULT_SIZE, MediaConstants.DEFAULT_SIZE);
this.mediaItem.isFavor().then((status: boolean) => {
this.mediaItem.isFavor().then((status: boolean): void => {
this.isFavourite = status;
})
} else {
startTraceWithTaskId("load MediaItem", this.mediaItem.index);
this.mediaItem.load(false).then(() => {
this.mediaItem.load(false).then((): void => {
finishTraceWithTaskId("load MediaItem", this.mediaItem.index);
this.thumbnail = this.mediaItem.getThumbnail(MediaConstants.DEFAULT_SIZE, MediaConstants.DEFAULT_SIZE);
this.isError = false;
Log.info(TAG, "getThumbnail2 " + this.thumbnail);
this.mediaItem.isFavor().then((status: boolean) => {
this.mediaItem.isFavor().then((status: boolean): void => {
this.isFavourite = status;
})
})
@ -157,7 +157,7 @@ export struct ImageGridItemComponent {
.rotate({ x: 0, y: 0, z: 1, angle: 0 })
.objectFit(ImageFit.Cover)
.autoResize(false)
.onComplete(() => {
.onComplete((): void => {
Log.debug(TAG, "Draw the image! " + this.thumbnail);
if (this.isEnteringPhoto && this.isPush) {
Log.info(TAG, "image onComplete, broadCast, thumbnail:"+this.thumbnail);
@ -170,7 +170,7 @@ export struct ImageGridItemComponent {
}
})
.onError(() => {
.onError((): void => {
Log.error(TAG, "alt Image " + this.mediaItem.index + " error :" + this.thumbnail);
if (this.thumbnail.length == 0 || this.mediaItem.width == 0 || this.mediaItem.height == 0) {
this.resetShow()
@ -224,7 +224,7 @@ export struct ImageGridItemComponent {
.width('100%')
.backgroundColor(this.isSelectedMode && this.mediaItem.isSelect ?
$r('app.color.item_selection_bg_color') : $r('app.color.transparent'))
.onClick(() => {
.onClick((): void => {
if (this.isSelectedMode) {
this.onSelected();
} else {
@ -234,7 +234,7 @@ export struct ImageGridItemComponent {
})
if (this.isSelectedMode) {
Image($r('app.media.ic_photo_preview'))
.onClick(() => {
.onClick((): void => {
this.isPreview = true;
this.jumpToPhotoBrowser();
Log.info(TAG, 'expand.');
@ -253,7 +253,7 @@ export struct ImageGridItemComponent {
x: $r('app.float.grid_item_checkbox_markAnchor'),
y: $r('app.float.grid_item_checkbox_markAnchor')
})
.onClick(() => {
.onClick((): void => {
this.onSelected();
})
}
@ -267,7 +267,7 @@ export struct ImageGridItemComponent {
duration: AnimationConstants.PRESS_ANIM_DURATION,
curve: Curve.Ease
})
.onTouch(event => {
.onTouch((event: TouchEvent): void => {
Log.info(TAG, "onTouch trigger: isSelectedMode: " + this.isSelectedMode +
", isEnteringPhoto: " + this.isEnteringPhoto + ", " + JSON.stringify(event));
if (this.isSelectedMode) {
@ -283,7 +283,7 @@ export struct ImageGridItemComponent {
this.pressAnimScale = 1;
}
})
.gesture(LongPressGesture().onAction((event: GestureEvent) => {
.gesture(LongPressGesture().onAction((event: GestureEvent): void => {
if (!this.isThird) {
Log.info(TAG, "LongPressGesture " + this.isSelectedMode);
this.selectStateChange();

View File

@ -39,7 +39,7 @@ export struct AlbumScrollBar {
? $r('app.float.album_scrollbar_select_size') : $r('app.float.album_scrollbar_normal_size'),
y: 0
})
.onTouch((event: TouchEvent) => {
.onTouch((event: TouchEvent): void => {
if (event.type == TouchType.Down) {
this.isClickScrollBar = true;
} else if (event.type == TouchType.Up) {

View File

@ -43,7 +43,7 @@ export struct GridScrollBar {
x: this.isClickScrollBar ? $r('app.float.scroll_bar_big_width') : $r('app.float.scroll_bar_small_width'),
y: 0
})
.onTouch((event: TouchEvent) => {
.onTouch((event: TouchEvent): void => {
if (event.type == TouchType.Down) {
this.isClickScrollBar = true;
} else if (event.type == TouchType.Up) {

View File

@ -229,7 +229,7 @@ export class MediaDataItem implements DateAdded {
fileAsset.displayName = displayName;
this.title = name;
fileAsset.title = name;;
fileAsset.title = name;
await fileAsset.commitModify();
}
}

View File

@ -106,7 +106,7 @@ export class ThirdDeleteOperation extends ProcessMenuOperation {
}
let item = this.items[this.currentBatch] as MediaDataItem;
if (item != null) {
item.onDelete().then<void, void>(() => {
item.onDelete().then<void, void>((): void => {
this.currentBatch++;
this.menuContext.broadCast.emit(BroadcastConstants.UPDATE_PROGRESS, [this.getExpectProgress(), this.currentBatch]);
this.cyclicOperation();

View File

@ -261,7 +261,7 @@ export default class MainAbility extends Ability {
//router.clear()需要等页面跳转完成后调用,如果不延时调用会发生崩溃。
AppStorage.SetOrCreate(Constants.ENTRY_FROM_HAP, 0)
setTimeout(() => {
setTimeout((): void => {
router.clear();
}, 10);
}

View File

@ -61,7 +61,7 @@ export default class ServiceExtAbility extends Extension {
name: "DeleteDialog " + appName + Math.random(), windowType: window.WindowType.TYPE_DIALOG, ctx: this.context
}
try {
window.createWindow(config, (err: BusinessError, data: window.Window) => {
window.createWindow(config, (err: BusinessError, data: window.Window): void => {
if (err.code != null) {
Log.info(TAG, "Failed to create the window. Cause : " + JSON.stringify(err));
return;
@ -76,9 +76,9 @@ export default class ServiceExtAbility extends Extension {
AppStorage.SetOrCreate("requestCallback", requestCallback);
Log.info(TAG, "Succeeded in get requestCallback");
windowClass.bindDialogTarget(requestInfo, () => {
windowClass.bindDialogTarget(requestInfo, (): void => {
Log.info(TAG, 'Dialog Window Need Destroy.');
}, (err: BusinessError) => {
}, (err: BusinessError): void => {
Log.error(TAG, 'Dialog bindDialogTarget err');
if (err.code != null) {
Log.error(TAG, "Failed to bind dialog target. Cause : " + JSON.stringify(err));
@ -86,14 +86,14 @@ export default class ServiceExtAbility extends Extension {
}
Log.error(TAG, 'Succeeded in binding dialog target.');
try {
windowClass.setUIContent('pages/ResourceDeletePage', (err: BusinessError) => {
windowClass.setUIContent('pages/ResourceDeletePage', (err: BusinessError): void => {
if (err.code != null) {
Log.error(TAG, "Failed to load the content. Cause : " + JSON.stringify(err));
return;
}
Log.error(TAG, "Succeeded in loading the content");
let promise = display.getDefaultDisplay();
promise.then((data: display.Display) => {
promise.then((data: display.Display): void => {
Log.error(TAG, "Succeeded in loading the content, width : " + data.width + ", height : " + data.height);
ScreenManager.setWinWidth(data.width)
windowClass.resetSize(data.width, data.height);
@ -120,10 +120,10 @@ export default class ServiceExtAbility extends Extension {
Log.info(TAG, 'done');
let onStart = this.globalThis.getObject("onStart1");
onStart = (() => {
onStart = ((): void => {
try {
Log.info(TAG, 'test start1');
windowClass.destroyWindow((err: BusinessError) => {
windowClass.destroyWindow((err: BusinessError): void => {
if (err.code != null) {
Log.info(TAG, "Failed to destroy the window. Cause : " + JSON.stringify(err));
return;

View File

@ -44,7 +44,7 @@ export struct TabBar {
aboutToAppear(): void {
this.onTabSelected = this.onTabSelected.bind(this);
this.tabs[this.currentIndex].isSelected = true;
this.tabs.forEach((tab: TabItem) => {
this.tabs.forEach((tab: TabItem): void => {
Log.info(this.TAG, JSON.stringify(tab.name) + " , " + tab.iconSelected);
});
}
@ -57,7 +57,7 @@ export struct TabBar {
}
this.currentIndex = index;
this.controller.changeIndex(this.currentIndex);
this.tabs.forEach((tab: TabItem) => {
this.tabs.forEach((tab: TabItem): void => {
tab.isSelected = false;
})
@ -72,11 +72,11 @@ export struct TabBar {
justifyContent: FlexAlign.Center
}) {
Column() {
ForEach(this.tabs, (tab: TabItem) => {
ForEach(this.tabs, (tab: TabItem): void => {
Stack() {
Tab({ tabItem: tab, index: this.tabs.indexOf(tab), onTabSelected: this.onTabSelected })
}.layoutWeight(1)
}, (tab): string => tab.name.id)
}, (tab: TabItem): string => { return tab.name.id.toString() })
}
.height(DEVICE_TYPE.DEVICE_PAD == this.deviceType ? $r('app.float.horizontal_width') : '100%')
}
@ -90,11 +90,11 @@ export struct TabBar {
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
ForEach(this.tabs, (tab: TabItem) => {
ForEach(this.tabs, (tab: TabItem): void => {
Stack() {
Tab({ tabItem: tab, index: this.tabs.indexOf(tab), onTabSelected: this.onTabSelected })
}.layoutWeight(1)
}, (tab): string => tab.name.id)
}, (tab: TabItem): string => { return tab.name.id.toString() })
}
.markAnchor({ x: '0%', y: '100%' })
.position({ x: '0%', y: '100%' })
@ -116,7 +116,7 @@ struct Tab {
aboutToAppear(): void {
this.isSelected = this.tabItem.isSelected;
this.appBroadcast.on(BroadcastConstants.RESET_TAB_SELECTED_STATUE, (pageNumber: number) => {
this.appBroadcast.on(BroadcastConstants.RESET_TAB_SELECTED_STATUE, (pageNumber: number): void => {
this.isSelected = this.index == pageNumber;
})
}
@ -144,7 +144,7 @@ struct Tab {
left: $r('app.float.tab_bar_text_padding_horizontal')
})
}
.onClick(() => {
.onClick((): void => {
if(this.onTabSelected != null) this.onTabSelected(this.index);
this.tabItem.isSelected = true;
this.appBroadcast.emit(BroadcastConstants.RESET_TAB_SELECTED_STATUE, [this.index]);
@ -167,7 +167,7 @@ export struct TabBarForAlbumSet {
aboutToAppear(): void {
this.onTabSelected = this.onTabSelected.bind(this);
this.tabs[this.currentIndex].isSelected = true;
this.tabs.forEach((tab: TabItemWithText) => {
this.tabs.forEach((tab: TabItemWithText): void => {
Log.info(this.TAG, JSON.stringify(tab.name) + ", " + tab.isSelected);
});
let col = screenManager.getScreenColumns();
@ -186,7 +186,7 @@ export struct TabBarForAlbumSet {
Log.info(this.TAG, "this.currentIndex: " + this.currentIndex + " index: " + index);
this.currentIndex = index;
this.controller.changeIndex(this.currentIndex);
this.tabs.forEach((tab: TabItemWithText) => {
this.tabs.forEach((tab: TabItemWithText): void => {
tab.isSelected = false;
})
Log.info(this.TAG, "select " + this.currentIndex);
@ -199,7 +199,7 @@ export struct TabBarForAlbumSet {
alignItems: ItemAlign.Start
}) {
Grid() {
ForEach(this.tabs, (tab: TabItemWithText) => {
ForEach(this.tabs, (tab: TabItemWithText): void => {
GridItem() {
TabWithText({
tabItemWithText: tab,
@ -207,7 +207,7 @@ export struct TabBarForAlbumSet {
onTabSelected: this.onTabSelected
})
}
}, (tab): string => tab.name.id)
}, (tab: TabItem): string => { return tab.name.id.toString() })
}
.width(this.tabWidth)
.columnsTemplate('1fr '.repeat(this.tabs.length))
@ -242,7 +242,7 @@ struct TabWithText {
}
Log.info(this.TAG, "index is " + this.index + " and TabWidth is " + this.TabWidth);
this.isSelected = this.tabItemWithText.isSelected;
this.appBroadcast.on(BroadcastConstants.RESET_TAB_SELECTED_TEXT, (pageNumber: number) => {
this.appBroadcast.on(BroadcastConstants.RESET_TAB_SELECTED_TEXT, (pageNumber: number): void => {
this.isSelected = this.index == pageNumber;
})
}
@ -271,7 +271,7 @@ struct TabWithText {
}
.height('100%')
.width('100%')
.onClick(() => {
.onClick((): void => {
if (!this.isAlbumSetSelectedMode) {
if(this.onTabSelected != null) this.onTabSelected(this.index)
this.tabItemWithText.isSelected = true;

View File

@ -52,7 +52,7 @@ export struct ActionBar {
build() {
Row() {
if (!this.actionBarProp.getLeftAction().equals(Action.NONE)) {
ForEach(this.createArray(), (item)=>{
ForEach(this.createArray(), (item: ActionBarProp): void => {
ActionBarButton({
res: item.getLeftAction().iconRes,
action: item.getLeftAction(),
@ -61,7 +61,7 @@ export struct ActionBar {
colorMode: item.getColorMode(),
isFirst: true
})
}, (item: ActionBarProp) => {return item.getLeftAction().actionID.toString()})
}, (item: ActionBarProp): string => {return item.getLeftAction().actionID.toString()})
}
if (this.actionBarProp.getMode() === ActionBarMode.DETAIL_MODE) {
} else if (this.actionBarProp.getMode() === ActionBarMode.SELECTION_MODE) {

View File

@ -19,6 +19,10 @@ import { ActionBarColorMode } from '../browserOperation/ActionBarMode'
import screenManager, { ColumnSize } from '@ohos/base/src/main/ets/manager/ScreenManager';
import { Constants } from '../../model/common/Constants';
export interface EventVisibility {
isVisible: boolean;
}
@Component
export struct ActionBarButton {
@StorageLink('isHorizontal') isHorizontal: boolean = screenManager.isHorizontal();
@ -33,13 +37,13 @@ export struct ActionBarButton {
@Builder PopupBuilder() {
Column() {
ForEach(this.moreMenuList, (menu: Action) => {
ForEach(this.moreMenuList, (menu: Action): void => {
Text(menu.textRes)
.width('100%')
.height($r('app.float.menu_height'))
.fontColor(menu.fillColor)
.fontSize($r('sys.float.ohos_id_text_size_body1'))
.onClick(() => {
.onClick((): void => {
this.showPopup = false;
if(this.onMenuClicked != null) this.onMenuClicked(menu);
})
@ -49,7 +53,7 @@ export struct ActionBarButton {
.strokeWidth(Constants.MENU_DIVIDER_STROKE_WIDTH)
.color($r('sys.color.ohos_id_color_list_separator'))
}
}, menu => JSON.stringify(menu.actionID))
}, (menu: Action): string => { return JSON.stringify(menu.actionID) })
}.width(screenManager.getColumnsWidth(ColumnSize.COLUMN_TWO))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
.padding({
@ -89,7 +93,7 @@ export struct ActionBarButton {
Row() {
this.ActionBarButtonBuilder()
}
.onClick(() => {
.onClick((): void => {
this.showPopup = !this.showPopup
})
.bindPopup(this.showPopup, {
@ -98,7 +102,7 @@ export struct ActionBarButton {
maskColor: 0x33000000,
popupColor: '#00FFFFFF',
enableArrow: false,
onStateChange: (e) => {
onStateChange: (e: EventVisibility): void => {
if (!e.isVisible) {
this.showPopup = false
}
@ -108,7 +112,7 @@ export struct ActionBarButton {
Row() {
this.ActionBarButtonBuilder()
}
.onClick(() => {
.onClick((): void => {
if(this.onMenuClicked != null) this.onMenuClicked(this.action)
})
}

View File

@ -25,7 +25,7 @@ export struct DetailMenuPanel {
build() {
Row() {
ForEach(this.actionBarProp.getMenuList(), (menu: Action) => {
ForEach(this.actionBarProp.getMenuList(), (menu: Action): void => {
ActionBarButton({
res: menu.iconRes,
action: menu,
@ -33,7 +33,7 @@ export struct DetailMenuPanel {
isAutoTint: menu.isAutoTint,
colorMode: this.actionBarProp.getColorMode()
})
}, menu => JSON.stringify(menu.actionID))
}, (menu: Action): string => { return JSON.stringify(menu.actionID) })
}.alignItems(VerticalAlign.Center)
}
}

View File

@ -34,7 +34,7 @@ export struct MenuPanel {
private onActionBarPropChanged(): void {
this.menuList = this.actionBarProp.getMenuList();
Log.info(this.TAG, "onActionBarPropChanged, menu's size: " + this.menuList.length);
this.menuList.forEach((menu: Action) => {
this.menuList.forEach((menu: Action): void => {
Log.info(this.TAG, "ActionId: " + menu.actionID);
})
}
@ -45,7 +45,7 @@ export struct MenuPanel {
build() {
Row() {
ForEach(this.actionBarProp.getMenuList(), (menu: Action) => {
ForEach(this.actionBarProp.getMenuList(), (menu: Action): void => {
ActionBarButton({
res: menu.iconRes,
action: menu,
@ -53,7 +53,7 @@ export struct MenuPanel {
isAutoTint: menu.isAutoTint,
colorMode: this.actionBarProp.getColorMode()
})
}, menu => JSON.stringify(menu.actionID))
}, (menu: Action): string => { return JSON.stringify(menu.actionID) })
}
.alignItems(VerticalAlign.Center)
}

View File

@ -15,6 +15,7 @@
import screenManager, { ColumnSize } from '@ohos/base/src/main/ets/manager/ScreenManager';
import { ToolBarButton } from './ToolBarButton';
import { EventVisibility } from './ActionBarButton';
import { Constants } from '../../model/common/Constants';
import { ActionBarProp } from '../browserOperation/ActionBarProp';
import { Action } from '../browserOperation/Action';
@ -51,13 +52,13 @@ export struct ToolBar {
@Builder PopupBuilder() {
Column() {
ForEach(this.moreMenuList, (menu: Action) => {
ForEach(this.moreMenuList, (menu: Action): void => {
Text(menu.textRes)
.width('100%')
.height($r('app.float.menu_height'))
.fontColor(menu.fillColor)
.fontSize($r('sys.float.ohos_id_text_size_body1'))
.onClick(() => {
.onClick((): void => {
this.showPopup = false;
if(this.onMenuClicked != null) this.onMenuClicked(menu);
})
@ -67,8 +68,7 @@ export struct ToolBar {
.strokeWidth(Constants.MENU_DIVIDER_STROKE_WIDTH)
.color($r('sys.color.ohos_id_color_list_separator'))
}
}, (menu): string => (menu.actionType != null ? menu.actionType.id : menu.actionID))
}, (menu: Action): string => { return (menu.actionType != null ? menu.actionType.id.toString() : menu.actionID.toString())})
}.width(screenManager.getColumnsWidth(ColumnSize.COLUMN_TWO))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
.padding({
@ -84,7 +84,7 @@ export struct ToolBar {
if (!this.isHorizontal) {
Row() {
Row() {
ForEach(this.toolMenuList, (menu: Action) => {
ForEach(this.toolMenuList, (menu: Action): void => {
if (menu == Action.MORE) {
Column() {
Row() {
@ -106,7 +106,7 @@ export struct ToolBar {
}
.width(Constants.PERCENT_HUNDRED / this.toolMenuList.length + "%")
.height('100%')
.onClick(() => {
.onClick((): void => {
this.showPopup = !this.showPopup
})
.bindPopup(this.showPopup, {
@ -115,7 +115,7 @@ export struct ToolBar {
maskColor: 0x33000000,
popupColor: '#00FFFFFF',
enableArrow: false,
onStateChange: (e) => {
onStateChange: (e: EventVisibility): void => {
if (!e.isVisible) {
this.showPopup = false
}
@ -142,13 +142,13 @@ export struct ToolBar {
}
.margin({ top: $r('sys.float.ohos_id_text_margin_vertical') })
}
.onClick(() => {
.onClick((): void => {
if(this.onMenuClicked != null) this.onMenuClicked(menu)
})
.width(Constants.PERCENT_HUNDRED / this.toolMenuList.length + "%")
.height('100%')
}
}, (menu): string => (menu.actionType != null ? menu.actionType.id : menu.actionID))
}, (menu: Action): string => { return (menu.actionType != null ? menu.actionType.id.toString() : menu.actionID.toString()) })
}
.width('100%')
.height(Constants.ActionBarHeight)

View File

@ -68,7 +68,7 @@ struct MediaOperationPage {
this.loadAlbums()
this.onMenuClicked = this.onMenuClicked.bind(this);
this.broadCast.on(BroadcastConstants.MEDIA_OPERATION, (albumInfo: SimpleAlbumDataItem, completedFunc?: Function) => {
this.broadCast.on(BroadcastConstants.MEDIA_OPERATION, (albumInfo: SimpleAlbumDataItem, completedFunc?: Function): void => {
router.back({
uri: '',
params: {
@ -82,7 +82,7 @@ struct MediaOperationPage {
}
private loadAlbums(): void {
this.albumsDataSource.reloadAlbumListItemData().then((isEmpty: boolean) => {
this.albumsDataSource.reloadAlbumListItemData().then((isEmpty: boolean): void => {
this.loadingFinish = true
this.albumsDataSource.notifyDataReload()
})
@ -169,12 +169,11 @@ struct MediaOperationPage {
alignItems: ItemAlign.Center
}) {
List() {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>) => {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>): void => {
ListItem() {
AlbumListCard({ item: item.get() })
}
}, (item: LazyItem<AlbumDataItem>) => (item == null) && (item.get() != undefined && item.get() != null) ?
JSON.stringify(item) : item.getHashCode())
}, (item: LazyItem<AlbumDataItem>): string => (item == null) && item.get() != null ? JSON.stringify(item) : item.getHashCode())
}
.divider({
strokeWidth: 1,

View File

@ -44,7 +44,7 @@ export struct AddNotesDialog {
Image($r('app.media.ic_gallery_public_cancel'))
}.height($r('app.float.icon_size'))
.width($r('app.float.icon_size'))
.onClick(() => {
.onClick((): void => {
if(this.dialogCallback != null) this.dialogCallback.cancelCallback();
this.controller.close()
})
@ -57,7 +57,7 @@ export struct AddNotesDialog {
.fontColor($r('app.color.text_input_font_color_182431'))
.maxLength(Constants.ADD_NOTES_MAX_LENGTH)
.enterKeyType(EnterKeyType.Done)
.onChange((value: string) => {
.onChange((value: string): void => {
Log.info(this.TAG, 'TextInput onChange : ' + value)
this.inputNote = value
this.isNull = this.inputNote === '';
@ -69,12 +69,12 @@ export struct AddNotesDialog {
Image($r('app.media.ic_gallery_public_ok'))
}.height($r('app.float.icon_size'))
.width($r('app.float.icon_size'))
.onClick(() => {
.onClick((): void => {
let check: RegExp = new RegExp("/[\\.\\\\/:*?<>\"|\[\]{}\s]/");
let passCheck = check.test(this.inputNote)
if (passCheck) {
getResourceString($r('app.string.specific_characters_not_supported'))
.then((message: string) => {
.then((message: string): void => {
showToast(message)
})
this.controller.close()

View File

@ -63,7 +63,7 @@ export struct CancelOperationDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.info(this.TAG, 'click continue')
this.cancelParam.continueFunc();
this.controller.close()
@ -92,7 +92,7 @@ export struct CancelOperationDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.info(this.TAG, 'click cancel')
this.cancelParam.cancelFunc();
this.controller.close()

View File

@ -56,7 +56,7 @@ export struct CopyOrMoveDialog {
}.alignItems(VerticalAlign.Center)
.height($r('app.float.dialog_list_card_height'))
.width('100%')
.onClick(() => {
.onClick((): void => {
this.controller.close()
this.operateParam.copyFunc();
})
@ -83,7 +83,7 @@ export struct CopyOrMoveDialog {
.width('100%')
.margin({
bottom: $r('app.float.select_model_dialog_margin') })
.onClick(() => {
.onClick((): void => {
this.controller.close()
this.operateParam.moveFunc();
})
@ -99,7 +99,7 @@ export struct CopyOrMoveDialog {
}
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
this.controller.close()
})
}.width('100%')

View File

@ -286,7 +286,7 @@ export struct CustomDialogView {
customStyle: true
});
this.broadCast.on(BroadcastConstants.SHOW_DETAIL_DIALOG, (item: MediaDataItem, isDistributed: boolean) => {
this.broadCast.on(BroadcastConstants.SHOW_DETAIL_DIALOG, (item: MediaDataItem, isDistributed: boolean): void => {
this.showDetailDialog(item, isDistributed)
});
@ -449,7 +449,7 @@ export struct CustomDialogView {
private showDetailDialog(item: MediaDataItem, isDistributed: boolean): void {
Log.info(TAG, 'SHOW_DETAIL_DIALOG ');
item.load(true).then(() => {
item.load(true).then((): void => {
this.mediaDetails = {
mediaType: item.mediaType,
height: item.height,

View File

@ -59,7 +59,7 @@ export struct DeleteDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.debug(this.TAG, 'cancelCallback');
this.controller.close();
if(this.dialogCallback != null) this.dialogCallback.cancelCallback();
@ -88,7 +88,7 @@ export struct DeleteDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.debug(this.TAG, 'confirmCallback');
this.controller.close();
if(this.dialogCallback != null) this.dialogCallback.confirmCallback();

View File

@ -213,7 +213,7 @@ export struct DetailsDialog {
}
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
this.controller.close()
})
}.width('100%')

View File

@ -67,7 +67,7 @@ export struct DownloadCancelOperationDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.info(this.TAG, 'click continue')
this.cancelParam.continueFunc();
this.controller.close()
@ -96,7 +96,7 @@ export struct DownloadCancelOperationDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.info(this.TAG, 'click cancel')
this.cancelParam.cancelFunc();
this.controller.close()

View File

@ -58,7 +58,7 @@ export struct EditExitDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
this.controller.close();
})
@ -85,7 +85,7 @@ export struct EditExitDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
this.controller.close();
if(this.editExitDialogCallback != null) this.editExitDialogCallback.discardCallback();
router.back()

View File

@ -156,7 +156,7 @@ export struct FindSameNameDialog {
.width($r('app.float.icon_size'))
.margin({
right: $r('app.float.details_dialog_button_margin_right') })
.onClick(() => {
.onClick((): void => {
this.isDoSameAction = !this.isDoSameAction
})
@ -185,7 +185,7 @@ export struct FindSameNameDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.debug(this.TAG, "replaceCallback");
if (this.isDoSameAction && this.findSameNameParam.doSameFunc != null) {
this.findSameNameParam.doSameFunc(FindSameOperation.REPLACE);
@ -218,7 +218,7 @@ export struct FindSameNameDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.debug(this.TAG, "skipCallback");
if (this.isDoSameAction && this.findSameNameParam.doSameFunc != null) {
this.findSameNameParam.doSameFunc(FindSameOperation.SKIP);
@ -251,7 +251,7 @@ export struct FindSameNameDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.debug(this.TAG, "cancelFunc");
if(this.findSameNameParam.cancelFunc != null) this.findSameNameParam.cancelFunc();
this.controller.close();

View File

@ -93,7 +93,7 @@ export struct MultiSelectDialog {
}
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
this.controller.close()
})
}

View File

@ -38,7 +38,7 @@ export struct NewAlbumDialog {
this.inputName = this.renameFileName;
this.isNull = this.inputName === '';
if (this.inputName.length === Constants.ALBUM_NAME_MAX_LENGTH) {
getResourceString($r('app.string.Maximum_length_reached')).then((message: string) => {
getResourceString($r('app.string.Maximum_length_reached')).then((message: string): void => {
showToast(message)
})
}
@ -66,11 +66,11 @@ export struct NewAlbumDialog {
.maxLength(Constants.ALBUM_NAME_MAX_LENGTH)
.enterKeyType(EnterKeyType.Done)
.backgroundColor($r('app.color.transparent'))
.onChange((value: string) => {
.onChange((value: string): void => {
Log.info(this.TAG, "TextInput onChange : " + value)
this.inputName = value
if (value.length === Constants.ALBUM_NAME_MAX_LENGTH) {
getResourceString($r('app.string.Maximum_length_reached')).then((message: string) => {
getResourceString($r('app.string.Maximum_length_reached')).then((message: string): void => {
showToast(message)
})
}
@ -102,7 +102,7 @@ export struct NewAlbumDialog {
.margin({ right: $r('app.float.details_dialog_button_margin_right') })
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
if(this.dialogCallback != null) this.dialogCallback.cancelCallback();
this.controller.close()
})
@ -128,11 +128,11 @@ export struct NewAlbumDialog {
.margin({ right: $r('app.float.details_dialog_button_margin_left') })
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
let check: RegExp = new RegExp("/[\\.\\\\/:*?<>\"|\[\]{}\s]/");
let passCheck = check.test(this.inputName)
if (passCheck) {
getResourceString($r('app.string.specific_characters_not_supported')).then((message: string) => {
getResourceString($r('app.string.specific_characters_not_supported')).then((message: string): void => {
showToast(message)
})
return

View File

@ -67,7 +67,7 @@ export struct ProgressDialog {
Image($r('app.media.ic_progress_cancel'))
.width($r('app.float.icon_size'))
.height($r('app.float.icon_size'))
.onClick(() => {
.onClick((): void => {
this.progressParam.cancelFunc();
})
}

View File

@ -39,7 +39,7 @@ export struct RenameDialog {
this.inputName = this.renameFileName;
this.isNull = this.inputName === '';
if (this.inputName.length === Constants.RENAME_MAX_LENGTH) {
getResourceString($r('app.string.Maximum_length_reached')).then<void, void>((message: string) => {
getResourceString($r('app.string.Maximum_length_reached')).then<void, void>((message: string): void => {
showToast(message)
});
}
@ -67,11 +67,11 @@ export struct RenameDialog {
.maxLength(Constants.RENAME_MAX_LENGTH)
.enterKeyType(EnterKeyType.Done)
.backgroundColor($r('app.color.transparent'))
.onChange((value: string) => {
.onChange((value: string): void => {
Log.info(this.TAG, "TextInput onChange : " + value)
this.inputName = value
if (value.length === Constants.RENAME_MAX_LENGTH) {
getResourceString($r('app.string.Maximum_length_reached')).then<void, void>((message: string) => {
getResourceString($r('app.string.Maximum_length_reached')).then<void, void>((message: string): void => {
showToast(message)
});
}
@ -103,7 +103,7 @@ export struct RenameDialog {
.margin({ right: $r('app.float.details_dialog_button_margin_right') })
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
if(this.dialogCallback != null) this.dialogCallback.cancelCallback();
this.controller.close()
})
@ -129,11 +129,11 @@ export struct RenameDialog {
.margin({ right: $r('app.float.details_dialog_button_margin_left') })
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
let check: RegExp = new RegExp("/[\\.\\\\/:*?<>\"|\[\]{}\s]/");
let passCheck = check.test(this.inputName);
if (passCheck) {
getResourceString($r('app.string.specific_characters_not_supported')).then<void, void>((message: string) => {
getResourceString($r('app.string.specific_characters_not_supported')).then<void, void>((message: string): void => {
showToast(message)
});
return;

View File

@ -55,7 +55,7 @@ export struct SaveDialog {
}
.height($r('app.float.details_dialog_button_height'))
.width('100%')
.onClick(() => {
.onClick((): void => {
this.controller.close()
}).backgroundColor($r('app.color.transparent'))
}
@ -81,7 +81,7 @@ export struct SaveDialog {
}
.height($r('app.float.details_dialog_button_height'))
.width('100%')
.onClick(() => {
.onClick((): void => {
this.broadCast.emit(BroadcastConstants.SHOW_EDIT_SAVE_PROGRESS_DIALOG, []);
this.controller.close()
if(this.saveDialogCallback != null) this.saveDialogCallback.replaceOriginalCallback()
@ -110,7 +110,7 @@ export struct SaveDialog {
}
.height($r('app.float.details_dialog_button_height'))
.width('100%')
.onClick(() => {
.onClick((): void => {
this.controller.close()
this.broadCast.emit(BroadcastConstants.SHOW_EDIT_SAVE_PROGRESS_DIALOG, []);
if(this.saveDialogCallback != null) this.saveDialogCallback.saveAsNewCallback()
@ -136,7 +136,7 @@ export struct SaveDialog {
}
.height($r('app.float.details_dialog_button_height'))
.margin({ bottom: $r('app.float.adjust_text_margin_bottom') })
.onClick(() => {
.onClick((): void => {
this.controller.close()
this.broadCast.emit(BroadcastConstants.SHOW_EDIT_SAVE_PROGRESS_DIALOG, []);
if(this.saveDialogCallback != null) this.saveDialogCallback.saveAsNewCallback()
@ -150,7 +150,7 @@ export struct SaveDialog {
}
.height($r('app.float.details_dialog_button_height'))
.margin({ bottom: $r('app.float.adjust_text_margin_bottom') })
.onClick(() => {
.onClick((): void => {
this.broadCast.emit(BroadcastConstants.SHOW_EDIT_SAVE_PROGRESS_DIALOG, []);
this.controller.close()
if(this.saveDialogCallback != null) this.saveDialogCallback.replaceOriginalCallback()
@ -164,7 +164,7 @@ export struct SaveDialog {
}
.height($r('app.float.details_dialog_button_height'))
.margin({ bottom: $r('app.float.adjust_text_padding_bottom_isVertical') })
.onClick(() => {
.onClick((): void => {
this.controller.close()
}).backgroundColor($r('app.color.transparent'))
}

View File

@ -91,7 +91,7 @@ export struct ThirdDeleteDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.debug(this.TAG, "cancelCallback");
this.controller.close();
if(this.dialogCallback != null) this.dialogCallback.cancelCallback();
@ -118,7 +118,7 @@ export struct ThirdDeleteDialog {
})
.backgroundColor($r('app.color.transparent'))
.height($r('app.float.details_dialog_button_height'))
.onClick(() => {
.onClick((): void => {
Log.debug(this.TAG, "confirmCallback");
this.controller.close();
if(this.dialogCallback != null) this.dialogCallback.confirmCallback();

View File

@ -198,9 +198,9 @@ export struct AlbumSetPage {
let self = this;
this.onMenuClicked = this.onMenuClicked.bind(this);
this.broadCast.on(BroadcastConstants.SELECT, (index: number) => this.onSelect(index));
this.broadCast.on(BroadcastConstants.SELECT, (index: number): void => this.onSelect(index));
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => {
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => {
self.initGridRowCount();
});
if (this.currentIndex == Constants.LOCAL_TAB_INDEX) {
@ -210,7 +210,7 @@ export struct AlbumSetPage {
this.tabs[Constants.LOCAL_TAB_INDEX].isSelected = false;
this.tabs[Constants.OTHER_EQUIPMENT_TAB_INDEX].isSelected = true;
}
this.distributedDataSource.reloadAlbumItemData().then((change: number) => {
this.distributedDataSource.reloadAlbumItemData().then((change: number): void => {
this.onUpdateRemoteDevice(change);
this.distributedDataSource.notifyDataReload();
})
@ -349,7 +349,7 @@ export struct AlbumSetPage {
private showNotify(): void {
if (this.needNotify) {
getResourceString($r('app.string.distributed_album_disconnected')).then((message: string) => {
getResourceString($r('app.string.distributed_album_disconnected')).then((message: string): void => {
showToast(message);
})
this.needNotify = false;
@ -383,7 +383,7 @@ export struct AlbumSetPage {
onMediaLibDataChange(changeType): void {
Log.info(TAG, 'onMediaLibDataChange type: ' + changeType);
if (changeType == MediaConstants.MEDIA_TYPE_REMOTE) {
this.distributedDataSource.reloadAlbumItemData().then((change: number) => {
this.distributedDataSource.reloadAlbumItemData().then((change: number): void => {
this.onUpdateRemoteDevice(change)
this.distributedDataSource.notifyDataReload()
})
@ -396,7 +396,7 @@ export struct AlbumSetPage {
private loadItem(): void {
if (this.isActive && this.isMediaLibDataChanged) {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean) => {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean): void => {
this.isEmpty = isEmpty;
this.albumsDataSource.notifyDataReload();
this.isHideScrollBar = (this.albumsDataSource.totalCount() <= (this.gridColumnsCount * Constants.NUMBER_3 - Constants.NUMBER_1));
@ -440,7 +440,7 @@ export struct AlbumSetPage {
private loadAlbums(isForce: boolean): void {
if (isForce || this.currentIndex == Constants.LOCAL_TAB_INDEX) {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean) => {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean): void => {
this.isEmpty = isEmpty;
this.albumsDataSource.notifyDataReload();
})
@ -453,7 +453,7 @@ export struct AlbumSetPage {
@Builder LocalAlbumSet() {
Stack() {
Grid(this.scroller) {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>) => {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>): void => {
if ((item != undefined && item != null) && (item.get() != undefined && item.get() != null) && item.get().index == 0) {
GridItem() {
AlbumGridItemNewStyle({
@ -470,8 +470,7 @@ export struct AlbumSetPage {
})
}
}
}, (item: LazyItem<AlbumDataItem>) => (item != undefined && item != null) && (item.get() != undefined && item.get() != null) ?
item.getHashCode() : JSON.stringify(item))
}, (item: LazyItem<AlbumDataItem>): string => item != null && item.get() != null ? item.getHashCode() : JSON.stringify(item))
}
.columnsTemplate('1fr '.repeat(this.gridColumnsCount))
.padding({
@ -490,11 +489,11 @@ export struct AlbumSetPage {
@Builder OtherEquipmentAlbumSet() {
Stack() {
Grid(this.scroller) {
LazyForEach(this.distributedDataSource, (item: PeerDataItem) => {
LazyForEach(this.distributedDataSource, (item: PeerDataItem): void => {
GridItem() {
DistributedAlbumGriItem({ item: item })
}
}, (item: PeerDataItem) => item ? item.getHashCode() : JSON.stringify(item))
}, (item: PeerDataItem): string => item ? item.getHashCode() : JSON.stringify(item))
}
.columnsTemplate('1fr '.repeat(this.gridColumnsCount))
.padding({
@ -549,7 +548,7 @@ export struct AlbumSetPage {
.barWidth(0)
.barHeight(0)
.flexGrow(1)
.onChange((index: number) => {
.onChange((index: number): void => {
Log.info(TAG, 'Switch to Tab ' + index + '.');
this.onDistributedTabChanged(index);
})

View File

@ -61,13 +61,13 @@ struct AlbumSelect {
aboutToAppear(): void {
startTrace('AlbumSetPageAboutToAppear');
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number) => {
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number): void => {
Log.info(TAG, 'ON_LOADING_FINISHED size: ' + size);
this.isEmpty = size == 0;
this.isHideScrollBar = (size <= (this.gridColumnsCount * Constants.NUMBER_3 - Constants.NUMBER_1));
});
let self = this;
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => {
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => {
self.initGridRowCount();
});
this.onActive();
@ -103,7 +103,7 @@ struct AlbumSelect {
}
private loadAlbums(): void {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean) => {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean): void => {
this.isEmpty = isEmpty;
this.albumsDataSource.notifyDataReload();
})
@ -183,8 +183,8 @@ struct AlbumSelect {
NoPhotoComponent({ title: $r('app.string.title_no_albums') })
}
Grid(this.scroller) {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>) => {
if ((item != undefined && item != null) && (item.get() != undefined && item.get() != null)) {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>): void => {
if (item != null && item.get() != null) {
if (item.index == 0){
GridItem() {
AlbumSelectGridItemNewStyle({
@ -201,8 +201,7 @@ struct AlbumSelect {
}
}
}
}, (item: LazyItem<AlbumDataItem>) => (item != undefined && item != null) && (item.get() != undefined && item.get() != null) ?
item.getHashCode() : JSON.stringify(item))
}, (item: LazyItem<AlbumDataItem>): string => item != null && item.get() != null ? item.getHashCode() : JSON.stringify(item))
}
.columnsTemplate('1fr '.repeat(this.gridColumnsCount))
.padding({

View File

@ -156,7 +156,7 @@ struct PhotoBrowser {
if (currentPhoto == undefined) {
return;
}
currentPhoto.setFavor().then((isSuccess: boolean) => this.setFavourite(isSuccess))
currentPhoto.setFavor().then((isSuccess: boolean): void => { return this.setFavourite(isSuccess) })
return;
} else if (action === Action.DELETE) {
if (currentPhoto == undefined) {
@ -222,7 +222,7 @@ struct PhotoBrowser {
if (currentPhoto == undefined) {
return;
}
currentPhoto.setOrientation().then(() => this.setOrientation())
currentPhoto.setOrientation().then((): void => this.setOrientation())
return;
} else if (action === Action.MOVE) {
this.backFromCopy = true;
@ -253,7 +253,7 @@ struct PhotoBrowser {
mediaDataItemCache.get(currentPhoto.uri).favouriteStatus = currentPhoto.favouriteStatus;
}
// 收藏相册进入大图点击取消收藏会导致Item成员变少所以要dataRemove
this.browserDataSource.reloadGroupItemData(false).then(() => {
this.browserDataSource.reloadGroupItemData(false).then((): void => {
this.operateEnd();
});
this.updateMenu();
@ -351,7 +351,7 @@ struct PhotoBrowser {
}
// PhotoItems 和 这里都会有load, 极端情况下可能产生一次无效的load
currentPhoto.load(false).then(() => {
currentPhoto.load(false).then((): void => {
this.photoDate = DateUtil.getLocalizedDate(currentPhoto.dateAdded);
if (this.pageFrom == Constants.ENTRY_FROM.DISTRIBUTED) {
this.timeAndLocation = "" + this.deviceName + "/" + DateUtil.getLocalizedTime(currentPhoto.dateAdded);
@ -368,7 +368,7 @@ struct PhotoBrowser {
return;
}
this.toolMenuList = [];
this.getActionList(currentPhoto).then((list: Action[]) => {
this.getActionList(currentPhoto).then((list: Action[]): void => {
if (this.pageFrom == Constants.ENTRY_FROM.CAMERA || this.pageFrom == Constants.ENTRY_FROM.CARD) {
this.menuList = [Action.GOTO_PHOTOS, Action.INFO];
} else if (this.pageFrom == Constants.ENTRY_FROM.RECYCLE) {
@ -425,7 +425,7 @@ struct PhotoBrowser {
async onMoveEnd(err, count, total): Promise<void> {
Log.debug(TAG, "onMoveEnd count: " + count + ", total: " + total);
if (err != null) {
getResourceString($r('app.string.move_failed_single')).then((message: string) => {
getResourceString($r('app.string.move_failed_single')).then((message: string): void => {
showToast(message)
})
return;
@ -442,7 +442,7 @@ struct PhotoBrowser {
Log.debug(TAG, "onCopyEnd count: " + count + ", total: " + total);
this.dataSourceLoadFinish()
if (err != null) {
getResourceString($r('app.string.copy_failed_single')).then((message: string) => {
getResourceString($r('app.string.copy_failed_single')).then((message: string): void => {
showToast(message);
})
}
@ -451,11 +451,11 @@ struct PhotoBrowser {
async onDownloadEnd(err, count, total): Promise<void> {
Log.debug(TAG, "onDownloadEnd count: " + count + ", total: " + total);
if (err != null) {
getResourceString($r('app.string.download_failed_single')).then((message: string) => {
getResourceString($r('app.string.download_failed_single')).then((message: string): void => {
showToast(message);
})
} else {
getResourceString($r('app.string.download_progress_done')).then((message: string) => {
getResourceString($r('app.string.download_progress_done')).then((message: string): void => {
showToast(message);
})
}
@ -516,7 +516,7 @@ struct PhotoBrowser {
AppStorage.SetOrCreate("isLeftSwiper", 0);
screenManager.setNavigationBarColor('#FFF1F3F5', '#FF000000');
this.hasAppeared = true;
mMultimodalInputManager.registerListener((control: number) => {
mMultimodalInputManager.registerListener((control: number): void => {
Log.info(TAG, "key control: " + control + " index " + this.currentIndex);
if (control == 0) {
if (this.currentIndex > 0) {
@ -572,7 +572,7 @@ struct PhotoBrowser {
this.onPhotoChanged(0);
}
} else {
this.browserDataSource.reloadGroupItemData(false).then((isEmpty: boolean) => {
this.browserDataSource.reloadGroupItemData(false).then((isEmpty: boolean): void => {
this.onPhotoChanged(0);
this.browserDataSource.notifyDataReload();
})
@ -595,7 +595,7 @@ struct PhotoBrowser {
}
AppStorage.SetOrCreate(Constants.ENTRY_FROM_HAP, Constants.ENTRY_FROM_NONE);
this.browserDataSource.setAlbumId(this.albumInfo.id);
this.browserDataSource.reloadGroupItemData(false).then((isEmpty: boolean) => {
this.browserDataSource.reloadGroupItemData(false).then((isEmpty: boolean): void => {
this.isDataChanged = isEmpty;
if (!Number.isNaN(AppStorage.Get(Constants.FROM_CURRENT_INDEX))) {
this.onPhotoChanged(AppStorage.Get(Constants.FROM_CURRENT_INDEX));
@ -616,32 +616,32 @@ struct PhotoBrowser {
this.onMenuClicked = this.onMenuClicked.bind(this);
// register event handling
this.broadCast.on(PhotoConstants.TOGGLE_BAR, () => {
this.broadCast.on(PhotoConstants.TOGGLE_BAR, (): void => {
this.onToggleBars();
});
this.broadCast.on(PhotoConstants.HIDE_BARS, () => {
this.broadCast.on(PhotoConstants.HIDE_BARS, (): void => {
this.hideBars();
});
this.broadCast.on(PhotoConstants.PULL_DOWN_START, () => {
this.broadCast.on(PhotoConstants.PULL_DOWN_START, (): void => {
Log.info(TAG, 'pulling down start');
});
this.broadCast.on(PhotoConstants.PULL_DOWN_END, () => {
this.broadCast.on(PhotoConstants.PULL_DOWN_END, (): void => {
this.pullDownFlag = true;
this.onBackPress();
});
this.broadCast.on(PhotoConstants.DATA_SIZE_CHANGED, (size: number) => {
this.broadCast.on(PhotoConstants.DATA_SIZE_CHANGED, (size: number): void => {
this.onDataSizeChanged(size);
});
this.broadCast.on(PhotoConstants.DATA_CONTENT_CHANGED, () => {
this.broadCast.on(PhotoConstants.DATA_CONTENT_CHANGED, (): void => {
this.onPhotoChanged(this.currentIndex);
});
this.broadCast.on(PhotoConstants.RENAME, (result: string[]) => {
this.broadCast.on(PhotoConstants.RENAME, (result: string[]): void => {
Log.info(TAG, "rename refresh: " + result[0] + ", " + result[1]);
let currentPhoto = this.getCurrentPhoto();
if (currentPhoto == undefined) {
@ -652,22 +652,22 @@ struct PhotoBrowser {
this.appBroadcast.emit(BroadcastConstants.UPDATE_DATA_SOURCE, [currentPhoto]);
});
this.broadCast.on(PhotoConstants.PULL_DOWN_START, (event) => {
this.broadCast.on(PhotoConstants.PULL_DOWN_START, (event: Object): void => {
Log.debug(TAG, "pulling down start: " + JSON.stringify(event));
this.isPullingDown = true;
})
this.broadCast.on(PhotoConstants.PULL_DOWN_CANCEL, () => {
this.broadCast.on(PhotoConstants.PULL_DOWN_CANCEL, (): void => {
Log.info(TAG, 'pulling down cancel');
this.isPullingDown = false;
})
this.broadCast.on(PhotoConstants.PHOTO_SHOW_STATE, (state: boolean) => {
this.broadCast.on(PhotoConstants.PHOTO_SHOW_STATE, (state: boolean): void => {
Log.debug(TAG, 'current photo show state change');
this.currentShow = state;
});
this.broadCast.on(PhotoConstants.SET_DISABLE_SWIPE, (value: boolean) => {
this.broadCast.on(PhotoConstants.SET_DISABLE_SWIPE, (value: boolean): void => {
Log.info(TAG, "set swiper swipe " + value);
this.canSwipe = value;
});
@ -796,7 +796,7 @@ struct PhotoBrowser {
Column() {
if (this.isShowBar) {
PhotoBrowserActionBar({
onMenuClicked: (action) => this.onMenuClicked(action)
onMenuClicked: (action: Action): void => { this.onMenuClicked(action) }
})
}
Text("" + (this.currentIndex + 1) + "/" + this.browserDataSource.totalCount())

View File

@ -63,7 +63,7 @@ struct SelectPhotoBrowser {
Log.info(TAG, 'photoBrowser aboutToAppear');
screenManager.setNavigationBarColor('#FFF1F3F5', '#FF000000');
this.browserBackgroundColor = $r('app.color.black');
mMultimodalInputManager.registerListener((control: number) => {
mMultimodalInputManager.registerListener((control: number): void => {
Log.info(TAG, "key control : " + control + " index " + this.currentIndex);
if (control == 0) {
if (this.currentIndex > 0) {
@ -116,26 +116,26 @@ struct SelectPhotoBrowser {
this.onMenuClicked = this.onMenuClicked.bind(this);
// register event handling
this.broadCast.on(PhotoConstants.TOGGLE_BAR, (event) => {
this.broadCast.on(PhotoConstants.TOGGLE_BAR, (event: Object): void => {
Log.info(TAG, "TOGGLE_BAR : " + JSON.stringify(event));
});
this.broadCast.on(PhotoConstants.PULL_DOWN_END, (event) => {
this.broadCast.on(PhotoConstants.PULL_DOWN_END, (event: Object): void => {
Log.info(TAG, "PULL_DOWN_END : " + JSON.stringify(event));
this.onBackPress();
});
this.broadCast.on(PhotoConstants.DATA_SIZE_CHANGED, (size: number) => {
this.broadCast.on(PhotoConstants.DATA_SIZE_CHANGED, (size: number): void => {
this.onDataSizeChanged(size);
});
this.broadCast.on(PhotoConstants.DATA_CONTENT_CHANGED, (size: number) => {
this.broadCast.on(PhotoConstants.DATA_CONTENT_CHANGED, (size: number): void => {
// onContentChanged only the current item is updated
Log.info(TAG, "DATA_CONTENT_CHANGED : " + size);
this.onPhotoChanged(this.currentIndex);
});
this.broadCast.on(PhotoConstants.SET_DISABLE_SWIPE, (value: boolean) => {
this.broadCast.on(PhotoConstants.SET_DISABLE_SWIPE, (value: boolean): void => {
Log.info(TAG, "set swiper swipe " + value);
this.canSwipe = value;
});

View File

@ -91,15 +91,15 @@ struct VideoBrowser {
Video({ src: this.uri, controller: this.myVideoController })
.controls(this.isShowBar)
.objectFit(ImageFit.Contain)
.onClick(() => {
.onClick((): void => {
this.isShowBar = !this.isShowBar;
})
.onStart(() => {
.onStart((): void => {
screenManager.setKeepScreenOn();
})
.onPause(() => {
.onPause((): void => {
})
.onFinish(() => {
.onFinish((): void => {
this.isShowBar = true;
screenManager.setKeepScreenOff();
})

View File

@ -83,7 +83,7 @@ struct DistributedAlbumSetPage {
}
this.onMenuClicked = this.onMenuClicked.bind(this);
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number) => {
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number): void => {
Log.info(TAG, 'ON_LOADING_FINISHED size: ' + size);
this.isEmpty = size == 0;
});
@ -168,7 +168,7 @@ struct DistributedAlbumSetPage {
private loadItem(): void {
if (this.isActive && this.isMediaLibDataChanged) {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean) => {
this.albumsDataSource.reloadAlbumItemData().then((isEmpty: boolean): void => {
this.isEmpty = isEmpty;
this.albumsDataSource.notifyDataReload();
})
@ -193,9 +193,9 @@ struct DistributedAlbumSetPage {
NoPhotoIndexComponent({ index: Constants.DISTRIBUTED_ALBUM_PAGE_INDEX })
} else {
Grid(this.scroller) {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>) => {
if ((item != undefined && item != null) && (item.get() != undefined && item.get() != null)){
if ((item != undefined && item != null) && item.index == 0) {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>): void => {
if (item != null && item.get() != null) {
if (item != null && item.index == 0) {
GridItem() {
AlbumGridItemTraditionalStyle({
item: item.get(),
@ -215,8 +215,7 @@ struct DistributedAlbumSetPage {
}
}
}
}, (item: LazyItem<AlbumDataItem>) => (item != undefined && item != null) && (item.get() != undefined && item.get() != null) ?
item.getHashCode() : JSON.stringify(item))
}, (item: LazyItem<AlbumDataItem>): string => item != null && item.get() != null ? item.getHashCode() : JSON.stringify(item))
}
.columnsTemplate('1fr '.repeat(this.gridColumnsCount))
.padding({

View File

@ -153,6 +153,6 @@ export class PhotoEditorManager {
if (filter != undefined) {
this.historyManager.push(filter);
}
return await Save.save(this.item, this.historyManager, isReplace);;
return await Save.save(this.item, this.historyManager, isReplace);
}
}

View File

@ -65,7 +65,7 @@ export struct ActionButton {
}
.height(this.text != undefined ? this.heightOfActionButton : $r('app.float.buttonWithoutText'))
.width(this.text != undefined ? this.widthOfActionButton : $r('app.float.buttonWithoutText'))
.onClick(() => {
.onClick((): void => {
this.broadCast.emit(Constants.UPDATE_MENU, [this.actionID]);
})
}

View File

@ -129,7 +129,7 @@ export struct CropImageShow {
Canvas(this.context)
.width(this.displayWidth)
.height(this.displayHeight)
.onReady(() => {
.onReady((): void => {
this.cropEdit.setCanvasContext(this.context)
})
Column() {
@ -138,18 +138,18 @@ export struct CropImageShow {
}
.width(this.flexWidth)
.height(this.flexHeight)
.onTouch((event) => {
.onTouch((event: TouchEvent): void => {
this.onTouchStart(event);
})
.gesture(
PinchGesture()
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent): void => {
this.onPinchGestureStart(event);
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent): void => {
this.onPinchGestureUpdate(event);
})
.onActionEnd(() => {
.onActionEnd((): void => {
this.onPinchGestureEnd();
})
)

View File

@ -37,7 +37,7 @@ export struct CropResetBar {
.width(this.isVerticalScreen
? $r('app.float.edit_horizontal_toolBar_size') : $r('app.float.default_button_size'))
.height(this.isVerticalScreen ? $r('app.float.offSet_size_1') : $r('app.float.default_button_size'))
.onClick(() => {
.onClick((): void => {
this.broadCast.emit(Constants.CROP_RESET_CLICKED, []);
})
}

View File

@ -247,11 +247,11 @@ export struct CropRulerBar {
Canvas(this.context)
.width(this.cWidth)
.height(this.cHeight)
.onReady(() => {
.onReady((): void => {
this.drawRuler()
})
}
.onTouch((event) => {
.onTouch((event: TouchEvent): void => {
this.onTouchEvent(event);
})
}

View File

@ -229,7 +229,7 @@ export struct CropStyleBar {
build() {
List() {
ForEach(this.menuChanged.menuArray, (item: ActionButtonInfo) => {
ForEach(this.menuChanged.menuArray, (item: ActionButtonInfo): void => {
ListItem() {
ActionButton({
src: item.src,

View File

@ -44,14 +44,14 @@ export struct TitleBar {
saveAsNewCallback(): void {
Log.debug(this.TAG, 'saveAsNewCallback called');
PhotoEditorManager.getInstance().save(false).then<void, void>((id: number) => {
PhotoEditorManager.getInstance().save(false).then<void, void>((id: number): void => {
this.saveImageCallback(id)
});
}
replaceOriginalCallback(): void {
Log.debug(this.TAG, 'replaceOriginalCallback called');
PhotoEditorManager.getInstance().save(true).then<void, void>((id: number) => {
PhotoEditorManager.getInstance().save(true).then<void, void>((id: number): void => {
this.saveImageCallback(id)
});
}
@ -64,7 +64,7 @@ export struct TitleBar {
Log.info(this.TAG, "saveImageCallback id = " + id);
if (id < 0) {
this.broadCast.emit(BroadcastConstants.EXIT_SAVE_PROGRESS_CLOSE, []);
getResourceString($r('app.string.edit_photo_save_fail')).then<void, void>((message: string) => {
getResourceString($r('app.string.edit_photo_save_fail')).then<void, void>((message: string): void => {
showToast(message)
})
router.back();
@ -140,7 +140,7 @@ export struct TitleBar {
left: $r('app.float.bottom_bar_padding'),
right: $r('app.float.adjust_text_margin_left')
})
.onClick(() => {
.onClick((): void => {
this.onBackClicked()
})
@ -177,7 +177,7 @@ export struct TitleBar {
.height($r('app.float.buttonWithoutText'))
.width($r('app.float.buttonWithoutText'))
.margin({ right: $r('app.float.bottom_bar_padding') })
.onClick(() => {
.onClick((): void => {
this.onSaveClicked()
})
}

View File

@ -107,7 +107,7 @@ export struct ToolBar {
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
ForEach(this.menuChanged.menuArray, (item: ActionButtonInfo) => {
ForEach(this.menuChanged.menuArray, (item: ActionButtonInfo): void => {
ActionButton({
src: item.src,
text: item.text,

View File

@ -102,9 +102,9 @@ struct FormEditorPage {
if (!this.isShow) {
return;
}
formProvider.setFormNextRefreshTime(this.formId, this.time).then(() => {
formProvider.setFormNextRefreshTime(this.formId, this.time).then((): void => {
Log.info(TAG, "setFormNextRefreshTime sucessfully");
}).catch((err) => {
}).catch((err: Error): void => {
Log.error(TAG, "init err " + err);
})
}
@ -117,19 +117,19 @@ struct FormEditorPage {
Log.debug(TAG, "updateFormData formId: " + JSON.stringify(this.formId));
let obj3 = this.bindFormData();
Log.debug(TAG, "updateFormData obj: " + JSON.stringify(obj3));
formProvider.updateForm(this.formId, obj3).then((data) => {
formProvider.updateForm(this.formId, obj3).then((data: void): void => {
Log.info(TAG, "updateFormData, data: " + JSON.stringify(data));
if (this.isShow) {
formProvider.setFormNextRefreshTime(this.formId, this.time).then(() => {
formProvider.setFormNextRefreshTime(this.formId, this.time).then((): void => {
this.terminate();
}).catch((err) => {
}).catch((err: Error): void => {
Log.error(TAG, "init err " + err);
this.terminate();
})
} else {
this.terminate();
}
}).catch((error) => {
}).catch((error): void => {
Log.error(TAG, "updateForm failed. Cause: " + JSON.stringify(error));
this.terminate();
});
@ -207,19 +207,19 @@ struct FormEditorPage {
Log.debug(TAG, 'aboutToAppear start!');
this.appBroadcast.on(BroadcastConstants.SAVE_FORM_EDITOR_DATA, this.saveDataFunc);
this.appBroadcast.on(Constants.FROM_PLAYBACK_INTERVAL, this.onChangeFunc);
dataStore.init().then(() => {
dataStore.init().then((): void => {
let intervalTimeKey = 'intervalTime';
dataStore.getData(intervalTimeKey, this.time).then((d) => {
dataStore.getData(intervalTimeKey, this.time).then((d: Object): void => {
this.time = d as number;
this.setIntervalTime();
AppStorage.SetOrCreate(Constants.FROM_PLAYBACK_INTERVAL, this.time);
})
let isShowKey = 'isShow_' + this.formId;
dataStore.getData(isShowKey, this.isShow).then((d) => {
dataStore.getData(isShowKey, this.isShow).then((d: Object): void => {
this.isShow = d as boolean;
})
let arkUriKey = 'arkUri_' + this.formId;
dataStore.getData(arkUriKey, this.arkUri).then((d) => {
dataStore.getData(arkUriKey, this.arkUri).then((d: Object): void => {
if (d == 0) {
d = 1;
} else {
@ -280,7 +280,7 @@ struct FormEditorPage {
.height($r('app.float.title_default'))
.alignItems(VerticalAlign.Center)
.width('100%')
.onClick(() => {
.onClick((): void => {
this.terminate();
})
@ -326,7 +326,7 @@ struct FormEditorPage {
})
.backgroundColor($r('app.color.white'))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
.onClick(() => {
.onClick((): void => {
this.selectPhoto();
})
}
@ -360,7 +360,7 @@ struct FormEditorPage {
})
.backgroundColor($r('app.color.white'))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
.onClick(() => {
.onClick((): void => {
this.selectAlbum();
})
}
@ -417,7 +417,7 @@ struct FormEditorPage {
})
.backgroundColor($r('app.color.white'))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_l'))
.onClick(() => {
.onClick((): void => {
this.setPlayInterval()
})
}

View File

@ -199,19 +199,19 @@ struct NewAlbumPage {
let item = JSON.parse(param.item.toString()) as AlbumDataItem;
this.groupDataSource.setAlbumId(item.id)
}
this.groupDataSource.reloadGroupItemData(true).then((isEmpty: boolean) => {
this.groupDataSource.reloadGroupItemData(true).then((isEmpty: boolean): void => {
this.isEmpty = isEmpty
this.groupDataSource.notifyDataReload()
this.isHideScrollBar = (this.groupDataSource.totalCount() <= Constants.GRID_SCROLL_BAR_VISIBLE_THRESHOLD)
})
this.onMenuClicked = this.onMenuClicked.bind(this);
this.broadCast.on(BroadcastConstants.SELECT, (index: number) => this.onSelect(index));
this.broadCast.on(BroadcastConstants.SELECT, (index: number): void => this.onSelect(index));
this.broadCast.on(BroadcastConstants.JUMP_PHOTO_BROWSER, (name: string, item: MediaDataItem) => {
this.broadCast.on(BroadcastConstants.JUMP_PHOTO_BROWSER, (name: string, item: MediaDataItem): void => {
this.jumpToPhotoBrowser(name, item)
})
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem) => {
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem): void => {
this.jumpToThirdPhotoBrowser(name, item)
})
@ -294,7 +294,7 @@ struct NewAlbumPage {
} else {
Stack() {
Grid(this.scroller) {
LazyForEach(this.groupDataSource, (item: LazyItem<MediaDataItem>) => {
LazyForEach(this.groupDataSource, (item: LazyItem<MediaDataItem>): void => {
GridItem() {
ImageGridItemComponent({
lazyItem: item,
@ -306,8 +306,7 @@ struct NewAlbumPage {
.aspectRatio(1)
.columnStart(item.get().index % this.gridRowCount)
.columnEnd(item.get().index % this.gridRowCount)
}, (item: LazyItem<AlbumDataItem>) => (item == null) && (item.get() != undefined && item.get() != null) ?
JSON.stringify(item) : item.getHashCode())
}, (item: LazyItem<AlbumDataItem>): string => (item == null) && item.get() != null ? JSON.stringify(item) : item.getHashCode())
}
.columnsTemplate('1fr '.repeat(this.gridRowCount))
.columnsGap(Constants.GRID_GUTTER)

View File

@ -191,7 +191,7 @@ struct PhotoGridPage {
this.broadCast.emit(BroadcastConstants.SHOW_DETAIL_DIALOG, [items[0], false]);
} else {
let size = 0;
items.forEach((item) => {
items.forEach((item: MediaDataItem): void => {
Log.debug(TAG, "openDetailsDialog item.size: " + item.size);
size = size + item.size;
})
@ -239,11 +239,11 @@ struct PhotoGridPage {
this.onModeChange();
mediaObserver.registerObserver(this.dataObserver);
if (err != null) {
getResourceString($r('app.string.copy_failed_single')).then((message: string) => {
getResourceString($r('app.string.copy_failed_single')).then((message: string): void => {
showToast(message);
})
} else {
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, () => this.groupDataSource.dataReload(true));
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, (): void => this.groupDataSource.dataReload(true));
this.isHideScrollBar = (this.groupDataSource.totalCount() <= Constants.GRID_SCROLL_BAR_VISIBLE_THRESHOLD)
}
}
@ -264,13 +264,13 @@ struct PhotoGridPage {
let message = str.replace('%d', count.toString());
showToast(message);
} else {
getResourceString($r('app.string.download_failed_single')).then((message: string) => {
getResourceString($r('app.string.download_failed_single')).then((message: string): void => {
showToast(message);
})
}
;
} else {
getResourceString($r('app.string.download_progress_done')).then((message: string) => {
getResourceString($r('app.string.download_progress_done')).then((message: string): void => {
showToast(message);
})
}
@ -286,11 +286,11 @@ struct PhotoGridPage {
this.onModeChange();
mediaObserver.registerObserver(this.dataObserver);
if (err != null) {
getResourceString($r('app.string.move_failed_single')).then((message: string) => {
getResourceString($r('app.string.move_failed_single')).then((message: string): void => {
showToast(message);
})
} else {
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, () => this.groupDataSource.dataReload(true));
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, (): void => this.groupDataSource.dataReload(true));
}
}
@ -303,7 +303,7 @@ struct PhotoGridPage {
Log.info(TAG, "onDeleteEnd");
this.onModeChange();
mediaObserver.registerObserver(this.dataObserver);
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, () => {
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, (): void => {
this.groupDataSource.dataRemove();
this.isEmpty = this.groupDataSource.groupDataItem.length==0 ? true : false;
this.isHideScrollBar = (this.groupDataSource.totalCount() <= Constants.GRID_SCROLL_BAR_VISIBLE_THRESHOLD)
@ -434,15 +434,15 @@ struct PhotoGridPage {
this.onMenuClicked = this.onMenuClicked.bind(this);
mediaObserver.registerObserver(this.dataObserver);
this.broadCast.on(BroadcastConstants.SELECT, (index: number) => this.onSelect());
this.broadCast.on(BroadcastConstants.JUMP_PHOTO_BROWSER, (name: string, item: MediaDataItem) => {
this.broadCast.on(BroadcastConstants.SELECT, (index: number): void => { this.onSelect() });
this.broadCast.on(BroadcastConstants.JUMP_PHOTO_BROWSER, (name: string, item: MediaDataItem): void => {
this.jumpToPhotoBrowser(name, item);
});
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem) => {
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem): void => {
this.jumpToThirdPhotoBrowser(name, item);
});
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number) => {
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number): void => {
Log.info(TAG, "ON_LOADING_FINISHED size: " + size);
});
this.appBroadcast.on(BroadcastConstants.UPDATE_DATA_SOURCE, this.onUpdateFavorAndSelectState.bind(this));
@ -452,7 +452,7 @@ struct PhotoGridPage {
this.appBroadcast.on(BroadcastConstants.ON_REMOTE_CHANGED, this.onUpdateRemoteDevice.bind(this));
}
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => {
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => {
this.initGridRowCount();
});
@ -500,7 +500,7 @@ struct PhotoGridPage {
private loadItem(): void {
if (this.isActive && this.isMediaLibDataChanged) {
this.groupDataSource.reloadGroupItemData(true).then((isEmpty) => {
this.groupDataSource.reloadGroupItemData(true).then((isEmpty: boolean): void => {
Log.info(TAG, "onMediaLibDataChange load finish");
this.isEmpty = isEmpty;
this.groupDataSource.notifyDataReload();
@ -600,7 +600,7 @@ struct PhotoGridPage {
} else {
Stack() {
Grid(this.scroller) {
LazyForEach(this.groupDataSource, (item: LazyItem<MediaDataItem>) => {
LazyForEach(this.groupDataSource, (item: LazyItem<MediaDataItem>): void => {
GridItem() {
ImageGridItemComponent({
lazyItem: item,
@ -612,8 +612,7 @@ struct PhotoGridPage {
.aspectRatio(1)
.columnStart(item.get().index % this.gridRowCount)
.columnEnd(item.get().index % this.gridRowCount)
}, (item: LazyItem<MediaDataItem>) => item == null && (item.get() != undefined && item.get() != null) ?
JSON.stringify(item) : item.getHashCode())
}, (item: LazyItem<MediaDataItem>): string => item == null && item.get() != null ? JSON.stringify(item) : item.getHashCode())
}
.columnsTemplate('1fr '.repeat(this.gridRowCount))
.columnsGap(Constants.GRID_GUTTER)

View File

@ -68,11 +68,11 @@ export struct CameraGridItemComponent {
.backgroundColor($r("app.color.recycle_album_bg_color"))
.justifyContent(FlexAlign.Center)
.alignItems(HorizontalAlign.Center)
.onClick((event: ClickEvent) => {
this.jumpCameraTakephoto().then((result: common.AbilityResult) => {
.onClick((event: ClickEvent): void => {
this.jumpCameraTakephoto().then((result: common.AbilityResult): void => {
Log.info(TAG, 'resourceUri = ' + result?.want?.parameters?.resourceUri);
this.resultUri = result?.want?.parameters?.resourceUri as string;
}).catch((err) => {
}).catch((err: Error): void => {
Log.error(TAG, 'jumpCameraTakephoto err: ' + err);
});
})
@ -114,7 +114,7 @@ export struct CameraGridItemComponent {
} as Want
};
let appContext = this.globalThis.getObject("appContext") as common.UIAbilityContext;
appContext.terminateSelfWithResult(abilityResult).then((result) => {
appContext.terminateSelfWithResult(abilityResult).then((result: void): void => {
Log.info(TAG, 'terminateSelf result: ' + result);
});
}

View File

@ -129,13 +129,13 @@ struct ThirdSelectAlbumSetPage {
Log.info(TAG, "ThirdSelectAlbumSetPage isFromWallpaper: " + this.isFromWallpaper);
Log.info(TAG, "ThirdSelectAlbumSetPage maxSelectCount: " + this.maxSelectCount);
Log.info(TAG, "ThirdSelectAlbumSetPage filterMediaType: " + this.filterMediaType);
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number) => {
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number): void => {
Log.info(TAG, "ON_LOADING_FINISHED size: " + size);
this.isEmpty = size == 0;
this.isHideScrollBar = (size <= (this.gridRowCount * Constants.NUMBER_3 - Constants.NUMBER_1));
});
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => {
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => {
this.initGridRowCount();
});
@ -163,7 +163,7 @@ struct ThirdSelectAlbumSetPage {
private async loadAlbums(): Promise<void> {
let displayName = await getResourceString($r('app.string.album_all'));
this.albumsDataSource.reloadAlbumItemData().then<void, void>((isEmpty: boolean) => {
this.albumsDataSource.reloadAlbumItemData().then<void, void>((isEmpty: boolean): void => {
this.isEmpty = isEmpty
this.albumsDataSource.notifyDataReload()
// 从三方拉起,直接跳转到所有相册
@ -242,9 +242,8 @@ struct ThirdSelectAlbumSetPage {
NoPhotoIndexComponent({ index: Constants.ALBUM_PAGE_INDEX })
}
Grid(this.scroller) {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>) => {
if ((item != undefined && item != null) && (item.get() != undefined && item.get() != null) &&
item.get().id != MediaConstants.ALBUM_ID_RECYCLE) {
LazyForEach(this.albumsDataSource, (item: LazyItem<AlbumDataItem>): void => {
if (item != null && item.get() != null && item.get().id != MediaConstants.ALBUM_ID_RECYCLE) {
if ( item.get().index == 0) {
GridItem() {
ThirdAlbumGridItem({
@ -271,8 +270,7 @@ struct ThirdSelectAlbumSetPage {
}
}
}
}, (item: LazyItem<AlbumDataItem>) => (item != undefined && item != null) && (item.get() != undefined && item.get() != null) ?
item.getHashCode() : JSON.stringify(item))
}, (item: LazyItem<AlbumDataItem>): string => item != null && item.get() != null ? item.getHashCode() : JSON.stringify(item))
}
.columnsTemplate('1fr '.repeat(this.gridRowCount))
.padding({

View File

@ -70,7 +70,7 @@ struct ThirdSelectPhotoBrowser {
Log.info(TAG, 'photoBrowser aboutToAppear');
screenManager.setNavigationBarColor('#FFF1F3F5', '#FF000000');
this.browserBackgroundColor = $r('app.color.black');
mMultimodalInputManager.registerListener((control: number) => {
mMultimodalInputManager.registerListener((control: number): void => {
Log.info(TAG, "key control : " + control + " index " + this.currentIndex);
if (control == 0) {
if (this.currentIndex > 0) {
@ -102,20 +102,20 @@ struct ThirdSelectPhotoBrowser {
this.onMenuClicked = this.onMenuClicked.bind(this);
this.broadCast.on(PhotoConstants.TOGGLE_BAR, () => {
this.broadCast.on(PhotoConstants.TOGGLE_BAR, (): void => {
this.onToggleBars();
});
this.broadCast.on(PhotoConstants.PULL_DOWN_END, () => {
this.broadCast.on(PhotoConstants.PULL_DOWN_END, (): void => {
this.onBackPress();
});
this.broadCast.on(PhotoConstants.DATA_SIZE_CHANGED, (size: number) => {
this.broadCast.on(PhotoConstants.DATA_SIZE_CHANGED, (size: number): void => {
this.onDataSizeChanged(size);
});
this.broadCast.on(PhotoConstants.DATA_CONTENT_CHANGED, () => {
this.broadCast.on(PhotoConstants.DATA_CONTENT_CHANGED, (): void => {
this.onPhotoChanged(this.currentIndex);
});
this.broadCast.on(PhotoConstants.SET_DISABLE_SWIPE, (value: boolean) => {
this.broadCast.on(PhotoConstants.SET_DISABLE_SWIPE, (value: boolean): void => {
Log.info(TAG, "set swiper swipe " + value);
this.canSwipe = value;
});
@ -254,7 +254,7 @@ struct ThirdSelectPhotoBrowser {
try {
Log.info(TAG, "grant permission success.");
let appContext: common.UIAbilityContext = this.globalThis.getObject("appContext") as common.UIAbilityContext;
appContext.terminateSelfWithResult(abilityResult).then((result) => {
appContext.terminateSelfWithResult(abilityResult).then((result: void): void => {
Log.info(TAG, "terminateSelf result: " + result);
});
} catch (err) {

View File

@ -151,7 +151,7 @@ struct ThirdSelectPhotoGridPage {
this.groupDataSource.setSelectType(this.filterMediaType);
Log.info(TAG, "ThirdSelectPhotoGridPage isMultiPick: " + this.isMultiPick + ", " +
"isFromWallpaper: " + param.isFromWallpaper + ", maxSelectCount: " + this.maxSelectCount + ", filterMediaType: " + this.filterMediaType);
this.groupDataSource.reloadGroupItemData(true).then<void, void>((isEmpty: boolean) => {
this.groupDataSource.reloadGroupItemData(true).then<void, void>((isEmpty: boolean): void => {
this.isEmpty = isEmpty;
this.selectedCount = this.groupDataSource.getSelectedCount();
this.groupDataSource.notifyDataReload();
@ -160,12 +160,12 @@ struct ThirdSelectPhotoGridPage {
this.initGridRowCount();
this.onMenuClicked = this.onMenuClicked.bind(this);
this.broadCast.on(BroadcastConstants.SELECT, (index: number) => this.onSelect(index));
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem) => {
this.broadCast.on(BroadcastConstants.SELECT, (index: number): Promise<void> => { return this.onSelect(index) });
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem): void => {
this.jumpToThirdPhotoBrowser(name, item);
})
this.broadCast.on(Constants.ON_LOADING_FINISHED,
(size: number) => {
(size: number): void => {
Log.info(TAG, "ON_LOADING_FINISHED size: " + size);
this.isEmpty = size == 0;
Log.info(TAG, "isEmpty: " + this.isEmpty)
@ -258,7 +258,7 @@ struct ThirdSelectPhotoGridPage {
}
.aspectRatio(1)
}
LazyForEach(this.groupDataSource, (item: LazyItem<MediaDataItem>) => {
LazyForEach(this.groupDataSource, (item: LazyItem<MediaDataItem>): void => {
GridItem() {
ImageGridItemComponent({
lazyItem: item,
@ -268,8 +268,8 @@ struct ThirdSelectPhotoGridPage {
isSelectUpperLimited: $isSelectUpperLimited
})
}
.aspectRatio(1)
}, (item: LazyItem<MediaDataItem>) => item == null && (item.get() != undefined && item.get() != null) ? JSON.stringify(item) : item.getHashCode())
.aspectRatio(1)
}, (item: LazyItem<MediaDataItem>): string => item == null && item.get() != null ? JSON.stringify(item) : item.getHashCode())
}
.columnsTemplate('1fr '.repeat(this.gridRowCount))
.columnsGap(Constants.GRID_GUTTER)
@ -312,7 +312,7 @@ struct ThirdSelectPhotoGridPage {
let self = this;
if (uriArray == null && uriArray == undefined) {
let appContext: common.UIAbilityContext = this.globalThis.getObject("appContext") as common.UIAbilityContext;
appContext.terminateSelfWithResult(abilityResult).then((result) => {
appContext.terminateSelfWithResult(abilityResult).then((result: void): void => {
Log.info(TAG, "terminateSelfWithResult result: " + result);
});
} else {
@ -320,7 +320,7 @@ struct ThirdSelectPhotoGridPage {
try {
Log.info(TAG, "grant permission success.");
let appContext: common.UIAbilityContext = this.globalThis.getObject("appContext") as common.UIAbilityContext;
appContext.terminateSelfWithResult(abilityResult).then((result) => {
appContext.terminateSelfWithResult(abilityResult).then((result: void): void => {
Log.info(TAG, "terminateSelfWithResult result: " + result);
});
} catch (err) {

View File

@ -68,7 +68,7 @@ export struct ThirdSelectedPanel {
Row() {
Radio({ value: "", group: "" })
.checked(this.isOriginalChecked)
.onClick(() => {
.onClick((): void => {
this.isOriginalChecked = !this.isOriginalChecked;
})
@ -93,7 +93,7 @@ export struct ThirdSelectedPanel {
.fontWeight(FontWeight.Medium)
.enabled(this.selectedCount > 0 ? true : false)
.opacity(this.selectedCount > 0 ? 1 : $r('app.float.disable_button_opacity'))
.onClick(() => {
.onClick((): void => {
this.onMenuClicked(Action.OK);
})
}
@ -110,17 +110,17 @@ export struct ThirdSelectedPanel {
if (this.selectedCount > 0) {
Scroll(this.selectedScroller) {
Row({ space: 8 }) {
ForEach(this.selectedMediaDataArray, (selectedItem: MediaDataItem) => {
ForEach(this.selectedMediaDataArray, (selectedItem: MediaDataItem): void => {
Stack({ alignContent: Alignment.Start }) {
Image(this.getThumbnailSafe(selectedItem.uri))
.height("100%")
.aspectRatio(1)
.objectFit(ImageFit.Cover)
.autoResize(false)
.onError(() => {
.onError((): void => {
Log.error(TAG, 'item Image error');
})
.onComplete(() => {
.onComplete((): void => {
Log.debug(TAG, "Draw the image! " + this.getThumbnailSafe(selectedItem.uri));
})
@ -170,14 +170,14 @@ export struct ThirdSelectedPanel {
x: $r('app.float.grid_item_favor_markAnchor_x'),
y: $r('app.float.grid_item_favor_markAnchor_y')
})
.onClick(() => {
.onClick((): void => {
selectedItem.setSelect(false);
this.broadCast.emit(BroadcastConstants.SELECT, [selectedItem.index]);
})
}
.height("100%")
.aspectRatio(1)
}, item => JSON.stringify(item))
}, (item: MediaDataItem): string => { return JSON.stringify(item) })
}
.margin({
left: $r('sys.float.ohos_id_max_padding_start'),

View File

@ -99,32 +99,32 @@ export struct TimelinePage {
Log.info(TAG, 'aboutToAppear');
this.moreMenuList = [Action.MOVE_INVALID, Action.COPY_INVALID, Action.INFO_INVALID];
mediaObserver.registerObserver(this.dataObserver);
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => this.initGridRowCount());
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => this.initGridRowCount());
this.appBroadcast.on(BroadcastConstants.BACK_PRESS_EVENT, this.onIndexBackPress.bind(this));
this.appBroadcast.on(BroadcastConstants.ON_TAB_CHANGED, this.onTabChanged.bind(this));
this.appBroadcast.on(BroadcastConstants.RESET_STATE_EVENT, this.onStateReset.bind(this));
this.appBroadcast.on(BroadcastConstants.UPDATE_DATA_SOURCE, this.onUpdateFavorAndSelectState.bind(this));
this.appBroadcast.on(BroadcastConstants.RESET_ZERO, (pageNumber: number) => {
this.appBroadcast.on(BroadcastConstants.RESET_ZERO, (pageNumber: number): void => {
if (pageNumber == Constants.TIMELINE_PAGE_INDEX) {
this.scroller.scrollEdge(Edge.Top);
}
});
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number) => {
this.broadCast.on(Constants.ON_LOADING_FINISHED, (size: number): void => {
Log.info(TAG, "ON_LOADING_FINISHED size: " + size);
});
this.broadCast.on(BroadcastConstants.SELECT, (index: number) => this.onSelect());
this.broadCast.on(BroadcastConstants.GROUP_SELECT, () => this.onSelect());
this.broadCast.on(BroadcastConstants.SELECT, (index: number): void => this.onSelect());
this.broadCast.on(BroadcastConstants.GROUP_SELECT, (): void => this.onSelect());
this.broadCast.on(BroadcastConstants.JUMP_PHOTO_BROWSER, (name: string, item: MediaDataItem) => {
this.broadCast.on(BroadcastConstants.JUMP_PHOTO_BROWSER, (name: string, item: MediaDataItem): void => {
this.jumpToPhotoBrowser(name, item)
});
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem) => {
this.broadCast.on(BroadcastConstants.JUMP_THIRD_PHOTO_BROWSER, (name: string, item: MediaDataItem): void => {
this.jumpToThirdPhotoBrowser(name, item)
});
this.broadCast.on(BroadcastConstants.INIT_DATE_TEXT, () => {
this.broadCast.on(BroadcastConstants.INIT_DATE_TEXT, (): void => {
this.dateText = DateUtil.getLocalizedYearAndMonth(this.timelineDataSource.groupItem[0].dateAdded);
})
@ -335,7 +335,7 @@ export struct TimelinePage {
if (this.isActive && this.isMediaLibDataChanged) {
this.isMediaLibDataChanged = false
startTrace("reloadTimelineItemData")
this.timelineDataSource.reloadTimelineItemData().then<void, void>((isEmpty) => {
this.timelineDataSource.reloadTimelineItemData().then<void, void>((isEmpty: boolean): void => {
finishTrace("reloadTimelineItemData");
Log.info(TAG, "onMediaLibDataChange load finish");
this.initLoadFinish = true;
@ -357,7 +357,7 @@ export struct TimelinePage {
this.broadCast.emit(BroadcastConstants.SHOW_DETAIL_DIALOG, [items[0], false]);
} else {
let size = 0;
items.forEach((item) => {
items.forEach((item: MediaDataItem): void => {
Log.debug(TAG, "openDetailsDialog item.size: " + item.size);
size = size + item.size;
})
@ -379,7 +379,7 @@ export struct TimelinePage {
mediaObserver.registerObserver(this.dataObserver);
animateTo({
duration: Constants.DELETE_ANIMATE_DURATION
}, () => {
}, (): void => {
this.timelineDataSource.dataRemove();
this.isHideScrollBar = (this.timelineDataSource.totalCount() <= Constants.SCROLL_BAR_VISIBLE_THRESHOLD);
})
@ -398,11 +398,11 @@ export struct TimelinePage {
finishTrace('onModeChange');
mediaObserver.registerObserver(this.dataObserver);
if (err != null) {
getResourceString($r('app.string.copy_failed_single')).then<void, void>((message: string) => {
getResourceString($r('app.string.copy_failed_single')).then<void, void>((message: string): void => {
showToast(message)
})
} else {
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, () => this.timelineDataSource.dataReload());
animateTo({ duration: Constants.DELETE_ANIMATE_DURATION }, (): void => this.timelineDataSource.dataReload());
this.isHideScrollBar = (this.timelineDataSource.totalCount() <= Constants.SCROLL_BAR_VISIBLE_THRESHOLD);
}
}
@ -419,7 +419,7 @@ export struct TimelinePage {
finishTrace('onModeChange');
mediaObserver.registerObserver(this.dataObserver);
if (err != null) {
getResourceString($r('app.string.move_failed_single')).then<void, void>((message: string) => {
getResourceString($r('app.string.move_failed_single')).then<void, void>((message: string): void => {
showToast(message)
})
}
@ -489,9 +489,8 @@ export struct TimelinePage {
Stack() {
Grid(this.scroller) {
LazyForEach(this.timelineDataSource, (item: LazyItem<DateAdded>) => {
if ((item != undefined && item != null) && (item.get() != undefined && item.get() != null) &&
item.get().viewType == ViewType.GROUP_TITLE) {
LazyForEach(this.timelineDataSource, (item: LazyItem<DateAdded>): void => {
if (item != null && item.get() != null && item.get().viewType == ViewType.GROUP_TITLE) {
GridItem() {
TimelineTitleComponent({
lazyItem: (item as LazyItem<TimelineDataItem>),
@ -512,7 +511,7 @@ export struct TimelinePage {
.columnStart((item as LazyItem<MediaDataItem>).get().index % this.gridRowCount)
.columnEnd((item as LazyItem<MediaDataItem>).get().index % this.gridRowCount)
}
}, (item): string => {
}, (item: LazyItem<DateAdded>): string => {
if (item == null || item.get() == null) {
return JSON.stringify(item)
}
@ -523,7 +522,7 @@ export struct TimelinePage {
.columnsGap(Constants.GRID_GUTTER)
.rowsGap(Constants.GRID_GUTTER)
.cachedCount(Constants.GRID_CACHE_ROW_COUNT)
.onScrollIndex((index: number) => {
.onScrollIndex((index: number): void => {
Log.debug(TAG, "onScrollIndex index " + index)
let item: DateAdded = this.timelineDataSource.getDataByIndex(index);
if (item != null) {

View File

@ -60,7 +60,7 @@ struct ResourceDeletePage {
Log.error(TAG, "aboutToAppear uris : " + JSON.stringify(uris));
let mediaDataItems: MediaDataItem[] = [];
if (uris != undefined && uris.length > 0) {
uris.forEach((uri: string, index: number) => {
uris.forEach((uri: string, index: number): void => {
let nullArray: string[] = [];
let mediaDataItem: MediaDataItem = new MediaDataItem("",nullArray,"",1);

View File

@ -137,7 +137,7 @@ struct IndexPage {
.barWidth(0)
.barHeight(0)
.flexGrow(1)
.onChange((index: number) => {
.onChange((index: number): void => {
this.resetTabState(this.currentIndex);
this.onTabChanged(index);
Log.info(this.TAG, "Switch to Tab " + this.currentIndex + ".");

View File

@ -131,7 +131,7 @@ struct IndexPage {
.barWidth(0)
.barHeight(0)
.flexGrow(1)
.onChange((index: number) => {
.onChange((index: number): void => {
this.resetTabState(this.currentIndex)
this.onTabChanged(index);
Log.info(this.TAG, "Switch to Tab " + this.currentIndex + ".")

View File

@ -68,9 +68,9 @@ export struct AlbumGridItemNewStyle {
aboutToAppear(): void {
Log.debug(TAG, 'aboutToAppear');
this.selectable = this.item.id != MediaConstants.ALBUM_ID_RECYCLE;
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => this.updateCardSize());
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => this.updateCardSize());
startTrace("loadAlbumItem");
this.item.load().then(() => {
this.item.load().then((): void => {
finishTrace("loadAlbumItem");
this.thumbnail = this.item.getThumbnail();
})
@ -78,7 +78,7 @@ export struct AlbumGridItemNewStyle {
}
onIndexPageShow(): void {
this.item.load().then(() => {
this.item.load().then((): void => {
this.thumbnail = this.item.getThumbnail();
})
}
@ -169,7 +169,7 @@ export struct AlbumGridItemNewStyle {
z: 1,
angle: 0
})
.onError(() => {
.onError((): void => {
Log.debug(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
@ -210,7 +210,7 @@ export struct AlbumGridItemNewStyle {
z: 1,
angle: 0
})
.onError(() => {
.onError((): void => {
Log.error(TAG, 'album is empty or its cover is error ' + this.thumbnail);
this.isEmptyAlbum = true;
})
@ -286,11 +286,11 @@ export struct AlbumGridItemNewStyle {
.height(this.gridHeight)
.gesture(
LongPressGesture()
.onAction(() => {
.onAction((): void => {
this.selectStateChange();
})
)
.onClick(() => {
.onClick((): void => {
if (this.isAlbumSetSelectedMode) {
this.selectStateChange();
} else {

View File

@ -21,15 +21,14 @@ import { PeerDataItem } from '@ohos/base/src/main/ets/data/PeerDataItem';
const TAG = "DistributedAlbumGriItem"
class Obj {
width: number = 0;
height: number = 0;
componentWidth: number = 0;
componentHeight: number = 0;
interface Event {
width: number;
height: number;
componentWidth: number;
componentHeight: number;
loadingStatus: number;
}
const obj = new Obj;
@Component
export struct DistributedAlbumGriItem {
item: PeerDataItem
@ -44,7 +43,7 @@ export struct DistributedAlbumGriItem {
Log.info(TAG, 'aboutToAppear new opp');
let self = this;
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => {
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => {
self.updateCardSize();
})
this.updateCardSize();
@ -72,11 +71,11 @@ export struct DistributedAlbumGriItem {
.height(this.gridHeight)
.offset({ x: 0, y: 0 })
.border({ radius: $r('sys.float.ohos_id_corner_radius_default_l') })
.onError(() => {
.onError((): void => {
Log.error(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
.onComplete((msg: typeof obj) => {
.onComplete((msg: Event): void => {
Log.debug(TAG, 'image load success. Size: ' + msg.width + 'x' + msg.height +
', componentSize: ' + msg.componentWidth + 'x' + msg.componentHeight);
})
@ -85,11 +84,11 @@ export struct DistributedAlbumGriItem {
.aspectRatio(this.gridAspectRatio)
.offset({ x: 0, y: 0 })
.border({ radius: $r('sys.float.ohos_id_corner_radius_default_l') })
.onError(() => {
.onError((): void => {
Log.error(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
.onComplete((msg: typeof obj) => {
.onComplete((msg: Event): void => {
Log.debug(TAG, 'image load success. Size: ' + msg.width + 'x' + msg.height +
', componentSize: ' + msg.componentWidth + 'x' + msg.componentHeight);
})
@ -126,7 +125,7 @@ export struct DistributedAlbumGriItem {
width: $r('app.float.album_cover_stroke_width'),
color: $r('app.color.album_cover_stroke_color')
})
.onClick(() => {
.onClick((): void => {
Log.info(TAG, 'After onClick: ' + JSON.stringify(this.item));
router.push({
uri: 'feature/distributedAlbum/view/DistributedAlbumSetPage',

View File

@ -88,7 +88,7 @@ export class AlbumSetRenameMenuOperation implements MenuOperation, MenuOperation
try {
let relativePath = await mediaModel.getPublicDirectory(MediaLib.DirectoryType.DIR_CAMERA) + name + "/";
let simpleAlbumDataItem: SimpleAlbumDataItem = new SimpleAlbumDataItem("", name, relativePath, "", "");
if (name != undefined && name != null) {
if (name != null) {
let isExit = await this.checkAlbumExit(simpleAlbumDataItem);
if (isExit) {
getResourceString($r('app.string.name_already_use')).then((message: string): void => {

View File

@ -84,22 +84,22 @@ export struct PhotoItem {
this.firstLoad = true;
this.isLoading = true;
this.thumbnail = this.item.getThumbnail(this.item.imgWidth, this.item.imgHeight);
this.item.load(true).then(() => {
this.item.load(true).then((): void => {
this.isLoading = false
this.updateThumbnail()
Log.info(TAG, "aboutToAppear loadFinish thumbnail " + this.thumbnail);
})
// register event handling
this.broadCast.on(Constants.TOUCH_EVENT + this.item.uri + this.timeStamp, (matrix: Matrix4.Matrix4Transit) => {
this.broadCast.on(Constants.TOUCH_EVENT + this.item.uri + this.timeStamp, (matrix: Matrix4.Matrix4Transit): void => {
this.matrix = matrix;
});
this.broadCast.on(Constants.DIRECTION_CHANGE + this.item.uri + this.timeStamp, (direction: PanDirection) => {
this.broadCast.on(Constants.DIRECTION_CHANGE + this.item.uri + this.timeStamp, (direction: PanDirection): void => {
Log.info(TAG, "direction: " + direction);
this.photoItemDirection = direction;
});
this.broadCast.on(Constants.ANIMATION_EVENT + this.item.uri + this.timeStamp, (animationOption: AnimationOption, animationEndMatrix: Matrix4TransitWithMatrix4x4) => {
this.broadCast.on(Constants.ANIMATION_EVENT + this.item.uri + this.timeStamp, (animationOption: AnimationOption, animationEndMatrix: Matrix4TransitWithMatrix4x4): void => {
Log.info(TAG, "animationOption: " + JSON.stringify(animationOption));
this.animationOption = animationOption;
this.animationEndMatrix = animationEndMatrix;
@ -115,7 +115,7 @@ export struct PhotoItem {
}
private updateThumbnail() {
getThumbnail(this.item, this.updateTransition == this.item.index).then((thumbnail: string) => {
getThumbnail(this.item, this.updateTransition == this.item.index).then((thumbnail: string): void => {
this.thumbnail = thumbnail
})
}
@ -138,7 +138,7 @@ export struct PhotoItem {
this.preItem.rotate = this.item.orientation;
this.preItem.width = this.item.imgWidth;
this.preItem.height = this.item.imgHeight;
if (this.eventPipeline != undefined && this.eventPipeline != null) {
if (this.eventPipeline != null) {
this.eventPipeline.onDataChanged(this.item)
}
return;
@ -156,7 +156,7 @@ export struct PhotoItem {
}
calcRatio(info: MediaDataItem): number {
if (info == null || info == undefined) {
if (info == null) {
return 1;
}
if (info.width == 0 || info.height == 0) {
@ -188,7 +188,7 @@ export struct PhotoItem {
duration: Constants.SHARE_TRANSITION_DURATION,
zIndex: 0,
})
.onComplete(() => {
.onComplete((): void => {
startTrace("PhotoItemComplete_" + this.item);
Log.info(TAG, "onComplete finish, index: " + this.item.index +", item: " + JSON.stringify(this.item) + ", uri: " + this.thumbnail + ".");
this.showError = false;
@ -198,7 +198,7 @@ export struct PhotoItem {
}
finishTrace("PhotoItemComplete_" + this.item.index);
})
.onError(() => {
.onError((): void => {
Log.error(TAG, "image show error " + this.thumbnail + " " + this.item.width + " " + this.item.height);
if (this.thumbnail.length == 0 || this.item.width == 0 || this.item.height == 0) {
this.updateThumbnail()
@ -215,7 +215,7 @@ export struct PhotoItem {
.height('100%')
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.onClick(() => {
.onClick((): void => {
this.broadCast.emit(Constants.TOGGLE_BAR, [null]);
})
.parallelGesture(
@ -224,7 +224,7 @@ export struct PhotoItem {
fingers: 2,
distance: 1
})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent): void => {
Log.debug(TAG, 'PinchGesture onActionStart');
startTrace("PinchGesture onActionStart")
if (this.isPullingDown) {
@ -239,7 +239,7 @@ export struct PhotoItem {
}
finishTrace("PinchGesture onActionStart")
})
.onActionUpdate((event) => {
.onActionUpdate((event: GestureEvent): void => {
Log.debug(TAG, "PinchGesture onActionUpdate scale: " + event.scale);
startTrace("PinchGesture onActionUpdate")
if (this.isPullingDown) {
@ -252,7 +252,7 @@ export struct PhotoItem {
}
finishTrace("PinchGesture onActionUpdate")
})
.onActionEnd(() => {
.onActionEnd((): void => {
Log.debug(TAG, 'PinchGesture onActionEnd');
startTrace("PinchGesture onActionEnd")
if (this.isPullingDown) {
@ -266,12 +266,12 @@ export struct PhotoItem {
animateTo({
duration: this.animationOption.duration,
curve: this.animationOption.curve,
onFinish: () => {
onFinish: (): void => {
this.eventPipeline.onAnimationEnd(this.animationEndMatrix);
this.animationOption = null;
this.animationEndMatrix = null;
}
}, () => {
}, (): void => {
this.matrix = this.animationEndMatrix;
})
}
@ -281,21 +281,21 @@ export struct PhotoItem {
PanGesture({
direction: this.photoItemDirection
})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent): void => {
startTrace("PanGesture onActionStart")
Log.debug(TAG, "PanGesture start offsetX: " +
vp2px(event.offsetX) + ", offsetY: " + vp2px(event.offsetY));
this.eventPipeline.onMoveStart(vp2px(event.offsetX), vp2px(event.offsetY));
finishTrace("PanGesture onActionStart")
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent): void => {
startTrace("PanGesture onActionUpdate")
Log.debug(TAG, "PanGesture update offsetX: " +
vp2px(event.offsetX) + ", offsetY: " + vp2px(event.offsetY));
this.eventPipeline.onMove(vp2px(event.offsetX), vp2px(event.offsetY));
finishTrace("PanGesture onActionUpdate")
})
.onActionEnd((event: GestureEvent) => {
.onActionEnd((event: GestureEvent): void => {
startTrace("PanGesture onActionEnd")
Log.debug(TAG, "PanGesture end offsetX: " +
vp2px(event.offsetX) + ", offsetY: " + vp2px(event.offsetY));
@ -304,12 +304,12 @@ export struct PhotoItem {
animateTo({
duration: this.animationOption.duration,
curve: this.animationOption.curve,
onFinish: () => {
onFinish: (): void => {
this.eventPipeline.onAnimationEnd(this.animationEndMatrix);
this.animationOption = null;
this.animationEndMatrix = null;
}
}, () => {
}, (): void => {
this.matrix = this.animationEndMatrix;
})
}
@ -318,7 +318,7 @@ export struct PhotoItem {
TapGesture({
count: 2
})
.onAction((event: GestureEvent) => {
.onAction((event: GestureEvent): void => {
if (this.isPullingDown) {
Log.debug(TAG, 'Not allow to double tap when pullingDown');
return;
@ -333,12 +333,12 @@ export struct PhotoItem {
animateTo({
duration: this.animationOption.duration,
curve: this.animationOption.curve,
onFinish: () => {
onFinish: (): void => {
this.eventPipeline.onAnimationEnd(this.animationEndMatrix);
this.animationOption = null;
this.animationEndMatrix = null;
}
}, () => {
}, (): void => {
this.matrix = this.animationEndMatrix;
})
}
@ -346,7 +346,7 @@ export struct PhotoItem {
)
)
.clip(true)
.onTouch((event) => {
.onTouch((event: TouchEvent): void => {
this.eventPipeline.onTouch(event);
})
// TODO Remind users when pictures of other devices cannot be show
@ -370,8 +370,8 @@ export struct PhotoItem {
}
.width($r('app.float.icon_video_size'))
.height($r('app.float.icon_video_size'))
.onClick(() => {
if (this.item != undefined) {
.onClick((): void => {
if (this.item != null) {
router.push({
uri: 'feature/browser/view/VideoBrowser',
params: {
@ -390,6 +390,6 @@ export struct PhotoItem {
private isVideoPlayBtnShow(): boolean {
Log.debug(TAG, "isVideoPlayBtnShow: " + this.item.mediaType);
return ((this.item != undefined && this.item != null) && (this.item.mediaType == MediaLib.MediaType.VIDEO));
return (this.item != null && (this.item.mediaType == MediaLib.MediaType.VIDEO));
}
}

View File

@ -37,20 +37,20 @@ export struct PhotoSwiper {
private swiperController: SwiperController;
aboutToAppear(): void {
this.broadCast.on(BroadcastConstants.ON_DATA_RELOADED, () => {
this.broadCast.on(BroadcastConstants.ON_DATA_RELOADED, (): void => {
Log.debug(TAG, 'animate to data reloaded start');
animateTo({
duration: AnimationConstants.DELETE_ANIMATE_DURATION,
onFinish: () => {
} }, () => {
if (this.dataSource != null && this.dataSource != undefined) {
onFinish: (): void => {
} }, (): void => {
if (this.dataSource != null) {
this.dataSource.dataRemove();
this.broadCast.emit(Constants.DATA_SIZE_CHANGED,[this.dataSource.totalCount()]);
}
})
});
this.broadCast.on(BroadcastConstants.CHANGE_SWIPER_DURATION, (value) => {
this.broadCast.on(BroadcastConstants.CHANGE_SWIPER_DURATION, (value: number): void => {
Log.debug(TAG, "change duration start " + value);
this.duration = value;
});
@ -58,7 +58,7 @@ export struct PhotoSwiper {
private getIndex(item: LazyItem<MediaDataItem>): number {
let ind = 1
if (item != undefined && item != null && item.index == this.currentIndex) {
if (item != null && item.index == this.currentIndex) {
ind = 2
}
return ind
@ -66,16 +66,15 @@ export struct PhotoSwiper {
build() {
Swiper(this.swiperController) {
LazyForEach(this.dataSource, (item: LazyItem<MediaDataItem>) => {
if (item != undefined && item != null && item.get() != undefined && item.get() != null) {
LazyForEach(this.dataSource, (item: LazyItem<MediaDataItem>): void => {
if (item != null && item.get() != null) {
PhotoItem({
item: item.get(),
pageName: this.photoSwiperTransition
})
.zIndex(this.getIndex(item))
}
}, (item: LazyItem<MediaDataItem>) => item == null && (item.get() != undefined && item.get() != null) ?
JSON.stringify(item) : item.getHashCode())
}, (item: LazyItem<MediaDataItem>): string => item == null && item.get() != null ? JSON.stringify(item) : item.getHashCode())
}
.itemSpace('8vp')
.gesture(PanGesture({
@ -84,7 +83,7 @@ export struct PhotoSwiper {
.index(this.currentIndex)
.indicator(false)
.loop(false)
.onChange((index: number) => {
.onChange((index: number): void => {
if (AppStorage.Get("isDelete") == 0) {
if (this.currentIndex - index == 1) {
AppStorage.SetOrCreate("isLeftSwiper", 1);

View File

@ -24,11 +24,12 @@ import screenManager from '@ohos/base/src/main/ets/manager/ScreenManager';
const TAG = "AlbumGridItemTraditionalStyle"
class Obj {
width: number = 0;
height: number = 0;
componentWidth: number = 0;
componentHeight: number = 0;
interface Event {
width: number;
height: number;
componentWidth: number;
componentHeight: number;
loadingStatus: number;
}
// Traditional style grid item for distributed album set page
@ -52,11 +53,11 @@ export struct AlbumGridItemTraditionalStyle {
aboutToAppear(): void {
Log.info(TAG, 'aboutToAppear new opp');
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => {
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => {
this.updateCardSize();
})
this.updateCardSize();
this.item.load().then(() => {
this.item.load().then((): void => {
this.thumbnail = this.item.getThumbnail()
})
}
@ -120,11 +121,11 @@ export struct AlbumGridItemTraditionalStyle {
z: 1,
angle: 0
})
.onError(() => {
.onError((): void => {
Log.debug(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
.onComplete((msg: Obj) => {
.onComplete((msg: Event): void => {
Log.debug(TAG, "image load success.Size: " + msg.componentWidth + "x" + msg.componentHeight);
})
}
@ -145,11 +146,11 @@ export struct AlbumGridItemTraditionalStyle {
z: 1,
angle: 0
})
.onError(() => {
.onError((): void => {
Log.debug(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
.onComplete((msg: Obj) => {
.onComplete((msg: Event): void => {
Log.debug(TAG, "image load success. Size: " + msg.width + "x" + msg.height +
", componentSize: " + msg.componentWidth + "x" + msg.componentHeight);
})
@ -188,7 +189,7 @@ export struct AlbumGridItemTraditionalStyle {
width: $r('app.float.album_cover_stroke_width'),
color: $r('app.color.album_cover_stroke_color')
})
.onClick(() => {
.onClick((): void => {
this.jumpToBrowser()
})
}

View File

@ -13,15 +13,15 @@
* limitations under the License.
*/
import { Constants } from '../constants//Constants';
import { Constants } from '../constants/Constants';
import { Broadcast } from '@ohos/base/src/main/ets/utils/Broadcast';
import broadcastManager from '@ohos/base/src/main/ets/manager/BroadcastManager';
import screenManager from '@ohos/base/src/main/ets/manager/ScreenManager';
interface SettingsType {
title: Resource,
value: string,
checked: boolean
title: Resource;
value: string;
checked: boolean;
}
@CustomDialog
@ -39,7 +39,7 @@ export struct SettingDialog {
];
aboutToAppear(): void {
this.settings.forEach((item) => {
this.settings.forEach((item: SettingsType): void => {
if (this.time == parseInt(item.value)) {
item.checked = true;
} else {
@ -60,7 +60,7 @@ export struct SettingDialog {
.height($r('app.float.dialog_title_height'))
List() {
ForEach(this.settings, (item, index) => {
ForEach(this.settings, (item: SettingsType, index: number): void => {
ListItem() {
Column() {
Row() {
@ -75,7 +75,7 @@ export struct SettingDialog {
}) {
Radio({ group: 'timeGroup', value: item.value })
.checked(item.checked)
.onChange((checked: boolean) => {
.onChange((checked: boolean): void => {
item.checked = checked;
if (checked) {
this.broadCast.emit(Constants.FROM_PLAYBACK_INTERVAL, [parseInt(item.value)]);
@ -107,7 +107,7 @@ export struct SettingDialog {
.height($r('app.float.details_dialog_button_height'))
.width('100%')
.margin({ bottom: $r('sys.float.ohos_id_text_paragraph_margin_s') })
.onClick(() => {
.onClick((): void => {
this.controller.close();
})
}

View File

@ -30,10 +30,10 @@ export struct AlbumListCard {
aboutToAppear(): void {
Log.info(TAG, 'album mediaSet ' + JSON.stringify(this.item));
this.item.load().then(() => {
this.item.load().then((): void => {
this.thumbnail = this.item.getThumbnail();
})
this.item.getVideoCount().then((videoCount: number) => {
this.item.getVideoCount().then((videoCount: number): void => {
this.mediaRes = this.showMediaRes(videoCount);
})
}
@ -75,7 +75,7 @@ export struct AlbumListCard {
.height($r('app.float.list_card_image_size'))
.width($r('app.float.list_card_image_size'))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_s'))
.onError(() => {
.onError((): void => {
if (this.thumbnail != null) {
this.useAlt = true;
}
@ -103,7 +103,7 @@ export struct AlbumListCard {
.alignItems(VerticalAlign.Center)
.width('100%')
.height($r('app.float.list_card_height'))
.onClick(() => {
.onClick((): void => {
this.mediaOperation();
})
}

View File

@ -54,8 +54,8 @@ export struct AlbumSelectGridItemNewStyle {
aboutToAppear(): void {
Log.debug(TAG, 'aboutToAppear + ' + this.item.uri);
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, () => this.updateCardSize());
this.item.load().then(() => {
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (): void => this.updateCardSize());
this.item.load().then((): void => {
this.thumbnail = this.item.getThumbnail()
})
this.updateCardSize();
@ -115,7 +115,7 @@ export struct AlbumSelectGridItemNewStyle {
z: 1,
angle: this.item.orientation
})
.onError(() => {
.onError((): void => {
Log.debug(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
@ -137,7 +137,7 @@ export struct AlbumSelectGridItemNewStyle {
angle: this.item.orientation
})
.border({ radius: $r('sys.float.ohos_id_corner_radius_default_l') })
.onError(() => {
.onError((): void => {
Log.debug(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
@ -189,7 +189,7 @@ export struct AlbumSelectGridItemNewStyle {
width: $r('app.float.album_cover_stroke_width'),
color: $r('app.color.album_cover_stroke_color')
})
.onClick(() => {
.onClick((): void => {
Log.info(TAG, 'After onClick, MediaSet is: ' + JSON.stringify(this.item));
router.push({
uri: 'feature/newAlbum/view/NewAlbumPage',

View File

@ -63,9 +63,9 @@ export struct ThirdAlbumGridItem {
aboutToAppear(): void {
Log.info(TAG, "aboutToAppear + " + this.item.uri)
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (size) => this.updateCardSize())
screenManager.on(screenManager.ON_WIN_SIZE_CHANGED, (size: number): void => this.updateCardSize())
this.updateCardSize();
this.item.load().then<void, void>(() => {
this.item.load().then<void, void>((): void => {
this.thumbnail = this.item.getThumbnail()
})
}
@ -113,7 +113,7 @@ export struct ThirdAlbumGridItem {
angle: 0
})
.fillColor($r('app.color.empty_or_recycle_album_icon'))
.onError(() => {
.onError((): void => {
Log.error(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
@ -137,7 +137,7 @@ export struct ThirdAlbumGridItem {
angle: 0
})
.fillColor($r('app.color.empty_or_recycle_album_icon'))
.onError(() => {
.onError((): void => {
Log.error(TAG, 'album is empty or its cover is error');
this.isEmptyAlbum = true;
})
@ -190,7 +190,7 @@ export struct ThirdAlbumGridItem {
width: $r('app.float.album_cover_stroke_width'),
color: $r('app.color.album_cover_stroke_color')
})
.onClick(() => {
.onClick((): void => {
if (this.isFromFa && (!this.isFromFaPhoto)) {
this.appBroadcast.emit(BroadcastConstants.SAVE_FORM_EDITOR_DATA,
[this.item.displayName, this.item.id, this.item.displayName, 0, true]);

View File

@ -65,7 +65,7 @@ export struct TimelineScrollBar {
Stack({ alignContent: Alignment.End }) {
if (this.isClickScrollBar && !this.isHideScrollBar) {
Column() {
ForEach(this.dataSource.groupItem, (year: TimelineDataItem) => {
ForEach(this.dataSource.groupItem, (year: TimelineDataItem): void => {
if (this.nodeGap(year.groupChild.length) > 0 || this.isFirst(year) || this.isLast(year)) {
Row() {
Text(DateUtil.getLocalizedYear(year.dateAdded))
@ -93,7 +93,7 @@ export struct TimelineScrollBar {
})
.visibility(this.isShowLocalizedYear(year) ? Visibility.Visible : Visibility.Hidden)
}
}, year => JSON.stringify(year))
}, (year: TimelineDataItem): string => { return JSON.stringify(year) })
}
.height('100%')
.margin({
@ -155,7 +155,7 @@ export struct TimelineScrollBar {
.width(this.isClickScrollBar
? $r('app.float.scroll_press_all_width') : $r('app.float.scroll_bar_small_width'),)
}
.onTouch((event: TouchEvent) => {
.onTouch((event: TouchEvent): void => {
if (this.dateText == '') {
Log.warn(TAG, "dateText is null")
this.broadCast.emit(BroadcastConstants.INIT_DATE_TEXT, [])

View File

@ -72,7 +72,7 @@ export struct TimelineTitleComponent {
.padding({
left: $r('app.float.group_title_padding_bottom'),
})
.onClick(() => {
.onClick((): void => {
this.selectStateChange()
})
}