From cf8fed90a4919498399fc77b69401aa109e51229 Mon Sep 17 00:00:00 2001 From: liujuan Date: Thu, 30 May 2024 17:04:01 +0800 Subject: [PATCH 1/5] Signed-off-by: liujuan Changes to be committed: --- .../view/ThirdSelectPhotoBrowserActionBar.ets | 4 ++-- .../main/ets/default/view/actionbar/ActionBar.ets | 2 +- .../browserOperation/MediaOperationActionBar.ets | 4 ++-- .../ets/default/view/album/AlbumGridItemNewStyle.ets | 2 +- .../ets/default/view/album/AlbumSelectActionBar.ets | 2 +- .../src/main/ets/default/view/album/AlbumSetPage.ets | 4 ++-- .../ets/default/view/album/AlbumSetPageActionBar.ets | 6 +++--- .../ets/default/view/album/AlbumSetPageToolBar.ets | 4 ++-- .../ets/default/view/album/NewAlbumPageActionBar.ets | 2 +- .../view/photoGrid/BatchRecoverMenuOperation.ets | 4 ++-- .../view/photoGrid/PhotoGridPageActionBar.ets | 4 ++-- .../default/view/photoGrid/PhotoGridPageToolBar.ets | 2 +- .../ets/default/view/ThirdSelectAlbumPageBase.ets | 2 +- .../ets/default/view/ThirdSelectPhotoBrowserBase.ets | 2 +- .../ets/default/view/ThirdSelectPhotoGridBase.ets | 6 +++--- .../ets/default/view/ThirdSelectedPageActionBar.ets | 2 +- feature/timeline/src/main/ets/view/TimelinePage.ets | 4 ++-- .../src/main/ets/view/TimelinePageActionBar.ets | 6 +++--- .../src/main/ets/view/TimelinePageToolBar.ets | 2 +- .../phone/src/main/ets/pages/DefaultPhotoPage.ets | 2 +- product/phone/src/main/ets/pages/EditMain.ets | 2 +- product/phone/src/main/ets/pages/NewAlbumPage.ets | 4 ++-- product/phone/src/main/ets/pages/VideoBrowser.ets | 4 ++-- .../src/main/ets/view/PhotoBrowserComponent.ets | 12 ++++++------ product/phone/src/main/ets/view/PhotoGridView.ets | 6 +++--- 25 files changed, 47 insertions(+), 47 deletions(-) diff --git a/common/src/main/ets/default/view/ThirdSelectPhotoBrowserActionBar.ets b/common/src/main/ets/default/view/ThirdSelectPhotoBrowserActionBar.ets index 7ed1ce33..7e45cf67 100644 --- a/common/src/main/ets/default/view/ThirdSelectPhotoBrowserActionBar.ets +++ b/common/src/main/ets/default/view/ThirdSelectPhotoBrowserActionBar.ets @@ -36,7 +36,7 @@ export struct ThirdSelectPhotoBrowserActionBar { @Link isShowBar: boolean; @Provide('selectedCount') selectedCount: number = 0; @Link @Watch('onSelectedCountChanged') totalSelectedCount: number; - @Provide moreMenuList: Action[] = new Array(); + @Provide moreMenuList: Action[] = []; @Provide hidePopup: boolean = false; private title: string | Resource = ''; private isThird: boolean = false; @@ -76,7 +76,7 @@ export struct ThirdSelectPhotoBrowserActionBar { private createActionBar(): void { let actionBarProp: ActionBarProp = new ActionBarProp(); - let menuList: Array = new Array(); + let menuList: Action[] = []; if (this.canEdit) { menuList.push(Action.EDIT); } diff --git a/common/src/main/ets/default/view/actionbar/ActionBar.ets b/common/src/main/ets/default/view/actionbar/ActionBar.ets index 561c4afe..a276daba 100644 --- a/common/src/main/ets/default/view/actionbar/ActionBar.ets +++ b/common/src/main/ets/default/view/actionbar/ActionBar.ets @@ -39,7 +39,7 @@ export struct ActionBar { @Prop isNeedPlaceholder: boolean = false; createArray(): ActionBarProp[] { - let actionBarProps = new Array(); + let actionBarProps: ActionBarProp[] = []; actionBarProps.push(this.actionBarProp); return actionBarProps; } diff --git a/common/src/main/ets/default/view/browserOperation/MediaOperationActionBar.ets b/common/src/main/ets/default/view/browserOperation/MediaOperationActionBar.ets index 5058d4a1..f95de88c 100644 --- a/common/src/main/ets/default/view/browserOperation/MediaOperationActionBar.ets +++ b/common/src/main/ets/default/view/browserOperation/MediaOperationActionBar.ets @@ -33,7 +33,7 @@ export struct MediaOperationActionBar { ScreenManager.getInstance().isHorizontal(); @State actionBarProp: ActionBarProp = new ActionBarProp(); @StorageLink('statusBarHeight') statusBarHeight: number = 0; - @Provide moreMenuList: Action[] = new Array(); + @Provide moreMenuList: Action[] = []; @Provide hidePopup: boolean = false; aboutToAppear(): void { @@ -54,7 +54,7 @@ export struct MediaOperationActionBar { } private createActionBar(): void { - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); if (this.loadingFinish) { menuList.push(Action.NEW); diff --git a/feature/browser/src/main/ets/default/view/album/AlbumGridItemNewStyle.ets b/feature/browser/src/main/ets/default/view/album/AlbumGridItemNewStyle.ets index 00b10a53..df4d04a7 100644 --- a/feature/browser/src/main/ets/default/view/album/AlbumGridItemNewStyle.ets +++ b/feature/browser/src/main/ets/default/view/album/AlbumGridItemNewStyle.ets @@ -258,7 +258,7 @@ export struct AlbumGridItemNewStyle { } initCurrentRightClickMenuList() { - this.currentRightClickMenuList = new Array(); + this.currentRightClickMenuList = []; if (!this.isAlbumSetSelectedMode) { this.currentRightClickMenuList.push(Action.MULTISELECT); } diff --git a/feature/browser/src/main/ets/default/view/album/AlbumSelectActionBar.ets b/feature/browser/src/main/ets/default/view/album/AlbumSelectActionBar.ets index a8f8cea5..b20b9ca1 100644 --- a/feature/browser/src/main/ets/default/view/album/AlbumSelectActionBar.ets +++ b/feature/browser/src/main/ets/default/view/album/AlbumSelectActionBar.ets @@ -62,7 +62,7 @@ export struct AlbumSelectActionBar { private createActionBar(): void { this.selectedCount = this.totalSelectedCount; - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); menuList.push(Boolean(this.totalSelectedCount) ? Action.OK : Action.OK_DISABLE); actionBarProp diff --git a/feature/browser/src/main/ets/default/view/album/AlbumSetPage.ets b/feature/browser/src/main/ets/default/view/album/AlbumSetPage.ets index 437f9986..7adeb8d5 100644 --- a/feature/browser/src/main/ets/default/view/album/AlbumSetPage.ets +++ b/feature/browser/src/main/ets/default/view/album/AlbumSetPage.ets @@ -71,7 +71,7 @@ export struct AlbumSetPage { isDataFreeze: boolean = false; // the switch of distributed page @Provide isTabBarShow: boolean = false; - @Provide rightClickMenuList: Array = new Array(); + @Provide rightClickMenuList: Action[] = []; @StorageLink('isHorizontal') isHorizontal: boolean = ScreenManager.getInstance().isHorizontal(); @StorageLink('statusBarHeight') statusBarHeight: number = 0; @StorageLink('deviceType') deviceType: string | undefined = AppStorage.get('deviceType'); @@ -254,7 +254,7 @@ export struct AlbumSetPage { updateRightClickMenuList() { if (this.isAlbumSetSelectedMode) { - this.rightClickMenuList = new Array(); + this.rightClickMenuList = []; if (!this.isDisableRename && this.selectedAlbumsCount == 1) { this.rightClickMenuList.push(Action.RENAME); } diff --git a/feature/browser/src/main/ets/default/view/album/AlbumSetPageActionBar.ets b/feature/browser/src/main/ets/default/view/album/AlbumSetPageActionBar.ets index 95667691..895604d1 100644 --- a/feature/browser/src/main/ets/default/view/album/AlbumSetPageActionBar.ets +++ b/feature/browser/src/main/ets/default/view/album/AlbumSetPageActionBar.ets @@ -40,7 +40,7 @@ export struct AlbumSetPageActionBar { @StorageLink('statusBarHeight') statusBarHeight: number = 0; onMenuClicked: Function = (): void => {}; @State isNeedPlaceholder: boolean = true; - @Provide moreMenuList: Action[] = new Array(); + @Provide moreMenuList: Action[] = []; @Provide hidePopup: boolean = false; private deviceType: string = ''; private actionBarPaddingTop: number | Resource = 0; @@ -90,7 +90,7 @@ export struct AlbumSetPageActionBar { private createHorizontalActionBar(): ActionBarProp { Log.info(TAG, `createHorizontalActionBar, isAlbumSetSelectedMode: ${this.isAlbumSetSelectedMode}`); - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); actionBarProp @@ -125,7 +125,7 @@ export struct AlbumSetPageActionBar { private createActionBar(): ActionBarProp { Log.info(TAG, `createActionBar, isAlbumSetSelectedMode: ${this.isAlbumSetSelectedMode}`); - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); menuList.push(Action.NEW); diff --git a/feature/browser/src/main/ets/default/view/album/AlbumSetPageToolBar.ets b/feature/browser/src/main/ets/default/view/album/AlbumSetPageToolBar.ets index 276f96ba..4fb243b8 100644 --- a/feature/browser/src/main/ets/default/view/album/AlbumSetPageToolBar.ets +++ b/feature/browser/src/main/ets/default/view/album/AlbumSetPageToolBar.ets @@ -21,8 +21,8 @@ const TAG: string = 'browser_AlbumSetPageToolBar'; @Component export struct AlbumSetPageToolBar { @Provide isShowBar: boolean = true; - @Provide toolMenuList: Array = new Array(); - @Provide moreMenuList: Action[] = new Array(); + @Provide toolMenuList: Action[] = []; + @Provide moreMenuList: Action[] = []; @Consume @Watch('updateToolbar') isAlbumSetSelectedMode: boolean; @Consume('selectedCount') @Watch('updateToolbar') selectedAlbumsCount: number; @Consume isDisableRename: boolean; diff --git a/feature/browser/src/main/ets/default/view/album/NewAlbumPageActionBar.ets b/feature/browser/src/main/ets/default/view/album/NewAlbumPageActionBar.ets index ce664fb5..ac6a78e6 100644 --- a/feature/browser/src/main/ets/default/view/album/NewAlbumPageActionBar.ets +++ b/feature/browser/src/main/ets/default/view/album/NewAlbumPageActionBar.ets @@ -32,7 +32,7 @@ export struct NewAlbumPageActionBar { @StorageLink('isHorizontal') @Watch('createActionBar') isHorizontal: boolean = ScreenManager.getInstance() .isHorizontal(); @State actionBarProp: ActionBarProp = new ActionBarProp(); - @Provide moreMenuList: Action[] = new Array(); + @Provide moreMenuList: Action[] = []; @Provide hidePopup: boolean = false; aboutToAppear(): void { diff --git a/feature/browser/src/main/ets/default/view/photoGrid/BatchRecoverMenuOperation.ets b/feature/browser/src/main/ets/default/view/photoGrid/BatchRecoverMenuOperation.ets index b95bd46a..06a16ae8 100644 --- a/feature/browser/src/main/ets/default/view/photoGrid/BatchRecoverMenuOperation.ets +++ b/feature/browser/src/main/ets/default/view/photoGrid/BatchRecoverMenuOperation.ets @@ -85,8 +85,8 @@ export class BatchRecoverMenuOperation extends ProcessMenuOperation { let endIndex = this.currentBatch * this.BATCH_SIZE; endIndex = Math.min(endIndex, this.uris.length); let operationImpl = BrowserOperationFactory.getFeature(BrowserOperationFactory.TYPE_PHOTO); - let fileAssets = new Array(); - let uris: Array = new Array(); + let fileAssets: FileAsset[] = []; + let uris: string[] = []; for (let index = startIndex; index < endIndex; index++) { uris.push(this.uris[index]); diff --git a/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageActionBar.ets b/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageActionBar.ets index c4881aa1..a1c414ba 100644 --- a/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageActionBar.ets +++ b/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageActionBar.ets @@ -73,7 +73,7 @@ export struct PhotoGridPageActionBar { } private createHorizontalActionBar(): ActionBarProp { - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); actionBarProp @@ -116,7 +116,7 @@ export struct PhotoGridPageActionBar { } private createActionBar(): ActionBarProp { - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); if (!this.isSystemAlbum && this.isDistributedAlbum == false) { diff --git a/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageToolBar.ets b/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageToolBar.ets index cf1158f6..ef05a0ae 100644 --- a/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageToolBar.ets +++ b/feature/browser/src/main/ets/default/view/photoGrid/PhotoGridPageToolBar.ets @@ -28,7 +28,7 @@ export struct PhotoGridPageToolBar { isRecycleAlbum: boolean = false; onMenuClicked: Function = (): void => {}; isDistributedAlbum: boolean = false; - @Provide toolMenuList: Array = new Array(); + @Provide toolMenuList: Action[] = []; @Consume hidePopup: boolean; aboutToAppear(): void { diff --git a/feature/thirdselect/src/main/ets/default/view/ThirdSelectAlbumPageBase.ets b/feature/thirdselect/src/main/ets/default/view/ThirdSelectAlbumPageBase.ets index 2f486b37..cc4c5be3 100644 --- a/feature/thirdselect/src/main/ets/default/view/ThirdSelectAlbumPageBase.ets +++ b/feature/thirdselect/src/main/ets/default/view/ThirdSelectAlbumPageBase.ets @@ -60,7 +60,7 @@ export struct ThirdSelectAlbumPageBase { @Provide broadCast: BroadCast = new BroadCast(); private albums: AlbumSetDataSource = new AlbumSetDataSource(this.broadCast); @Provide isSelectedMode: boolean = true; - @Provide moreMenuList: Array = new Array(); + @Provide moreMenuList: Action[] = []; selectManager?: ThirdSelectManager; @Provide gridColumnsCount: number = 3; isActive = false; diff --git a/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets b/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets index 69d5cb63..a4b076cf 100644 --- a/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets +++ b/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets @@ -947,7 +947,7 @@ export struct ThirdSelectPhotoBrowserBase { */ class ThirdBrowserDataSource extends PhotoDataSource { private isSelectMode = false; - private selectedItems: MediaItem[] = new Array(); + private selectedItems: MediaItem[] = []; totalCount() { if (this.isSelectMode) { diff --git a/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoGridBase.ets b/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoGridBase.ets index 1ce97744..516dd210 100644 --- a/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoGridBase.ets +++ b/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoGridBase.ets @@ -77,8 +77,8 @@ let localStorage = LocalStorage.getShared(); export struct ThirdSelectPhotoGridBase { @State selectedCount: number = 0; @Provide isSelectedMode: boolean = true; - @Provide moreMenuList: Array = new Array(); - @Provide rightClickMenuList: Array = new Array(); + @Provide moreMenuList: Action[] = []; + @Provide rightClickMenuList: Action[] = []; photoDataImpl: PhotoDataImpl | undefined = BrowserDataFactory.getFeature(BrowserDataFactory.TYPE_PHOTO) as PhotoDataImpl; smartPickerDataImpl: SmartPickerDataImpl | undefined; @@ -165,7 +165,7 @@ export struct ThirdSelectPhotoGridBase { } else if (action.actionID === Action.CANCEL.actionID) { this.setPickResult(); } else if (action.actionID === Action.OK.actionID) { - let uriArray: Array = new Array(); + let uriArray: string[] = []; if (this.selectManager !== null) { uriArray = SelectUtil.getUriArray(this.selectManager.clickedSet); } diff --git a/feature/thirdselect/src/main/ets/default/view/ThirdSelectedPageActionBar.ets b/feature/thirdselect/src/main/ets/default/view/ThirdSelectedPageActionBar.ets index 6dc3ae66..c35e411d 100644 --- a/feature/thirdselect/src/main/ets/default/view/ThirdSelectedPageActionBar.ets +++ b/feature/thirdselect/src/main/ets/default/view/ThirdSelectedPageActionBar.ets @@ -21,7 +21,7 @@ import { IS_HORIZONTAL, SelectParams } from '../utils/ThirdSelectConstants'; export struct ThirdSelectedPageActionBar { @StorageLink(IS_HORIZONTAL) @Watch('createActionBar') isHorizontal: boolean = ScreenManager.getInstance() .isHorizontal(); - @State menuList: Array = new Array(); + @State menuList: Action[] = []; selectParams: SelectParams = SelectParams.defaultParam(); @Provide selectedCount: number = 0; @Link @Watch('onSelectedCountChanged') totalSelectedCount: number; diff --git a/feature/timeline/src/main/ets/view/TimelinePage.ets b/feature/timeline/src/main/ets/view/TimelinePage.ets index c43a4bb6..9a412dda 100644 --- a/feature/timeline/src/main/ets/view/TimelinePage.ets +++ b/feature/timeline/src/main/ets/view/TimelinePage.ets @@ -89,8 +89,8 @@ export struct TimelinePage { deleteMode = false; // Is delete mode isActive = false; // Is the page active routerStart = false; // Is move or copy router page - @Provide moreMenuList: Action[] = new Array(); - @Provide rightClickMenuList: Array = new Array(); + @Provide moreMenuList: Action[] = []; + @Provide rightClickMenuList: Action[] = []; @State groupSelectMode: boolean[] = []; @Provide yearData: TimelineData[] = []; @Provide dateText: string = ''; diff --git a/feature/timeline/src/main/ets/view/TimelinePageActionBar.ets b/feature/timeline/src/main/ets/view/TimelinePageActionBar.ets index 101d23fe..b4f8d981 100644 --- a/feature/timeline/src/main/ets/view/TimelinePageActionBar.ets +++ b/feature/timeline/src/main/ets/view/TimelinePageActionBar.ets @@ -88,7 +88,7 @@ export struct TimelinePageActionBar { } private createHorizontalActionBar(): ActionBarProp { - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); if (!this.isEmpty && this.deviceType === Constants.PC_DEVICE_TYPE) { menuList.push(Action.MULTISELECT); @@ -102,7 +102,7 @@ export struct TimelinePageActionBar { .setMode(ActionBarMode.STANDARD_MODE); Log.info(TAG, `createActionBar, isSelectedMode: ${this.isSelectedMode}`); if (this.isSelectedMode) { - menuList = new Array(); + menuList = []; menuList.push((this.isAllSelected ? Action.DESELECT_ALL : Action.SELECT_ALL), Boolean(this.selectedCount) ? Action.DELETE : Action.DELETE_INVALID, Action.MORE); actionBarProp @@ -115,7 +115,7 @@ export struct TimelinePageActionBar { } private createActionBar(): ActionBarProp { - let menuList: Array = new Array(); + let menuList: Action[] = []; let actionBarProp: ActionBarProp = new ActionBarProp(); actionBarProp .setHasTabBar(this.isSidebar) diff --git a/feature/timeline/src/main/ets/view/TimelinePageToolBar.ets b/feature/timeline/src/main/ets/view/TimelinePageToolBar.ets index a186eb8c..71533441 100644 --- a/feature/timeline/src/main/ets/view/TimelinePageToolBar.ets +++ b/feature/timeline/src/main/ets/view/TimelinePageToolBar.ets @@ -25,7 +25,7 @@ export struct TimelinePageToolBar { @Link @Watch('updateToolbar') totalSelectedCount: number; @Provide selectedCount: number = 0; onMenuClicked: Function = (): void => {}; - @Provide toolMenuList: Array = new Array(); + @Provide toolMenuList: Action[] = []; @Consume moreMenuList: Action[]; @Consume hidePopup: boolean; diff --git a/product/phone/src/main/ets/pages/DefaultPhotoPage.ets b/product/phone/src/main/ets/pages/DefaultPhotoPage.ets index 206d2fee..bb0b191f 100644 --- a/product/phone/src/main/ets/pages/DefaultPhotoPage.ets +++ b/product/phone/src/main/ets/pages/DefaultPhotoPage.ets @@ -42,7 +42,7 @@ export struct DefaultPhotoPage { @Provide pageFrom: number = Constants.ENTRY_FROM.NORMAL; @State broadCast: BroadCast = new BroadCast(); @Provide('transitionIndex') currentIndex: number = Constants.NUMBER_0; - @Provide moreMenuList: Array = new Array(); + @Provide moreMenuList: Action[] = []; @State actionBarProp: ActionBarProp = new ActionBarProp(); @StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode(); @StorageLink('isHorizontal') isHorizontal: boolean = ScreenManager.getInstance().isHorizontal(); diff --git a/product/phone/src/main/ets/pages/EditMain.ets b/product/phone/src/main/ets/pages/EditMain.ets index 44dade58..721fc6ec 100644 --- a/product/phone/src/main/ets/pages/EditMain.ets +++ b/product/phone/src/main/ets/pages/EditMain.ets @@ -56,7 +56,7 @@ export struct EditMain { @Provide mainBottomSize: number = Constants.BOTTOM_TOOL_BAR_SIZE; @Provide titleSize: number = Constants.TOP_BAR_SIZE; @Provide filterBottomSize: number = Constants.FILTER_BOTTOM_TOOL_BAR_SIZE; - @Provide moreMenuList: Array = new Array(); + @Provide moreMenuList: Action[] = []; @StorageLink('leftBlank') leftBlank: number[] = [ Constants.NUMBER_0, diff --git a/product/phone/src/main/ets/pages/NewAlbumPage.ets b/product/phone/src/main/ets/pages/NewAlbumPage.ets index 26b4b161..b1dc8b27 100644 --- a/product/phone/src/main/ets/pages/NewAlbumPage.ets +++ b/product/phone/src/main/ets/pages/NewAlbumPage.ets @@ -63,8 +63,8 @@ export struct NewAlbumPage { @Provide broadCast: BroadCast = new BroadCast(); @Provide isShow: boolean = true; @Provide isShowBar: boolean = true; - @State moreMenuList: Array = new Array(); - @Provide rightClickMenuList: Array = new Array(); + @State moreMenuList: Action[] = []; + @Provide rightClickMenuList: Action[] = []; @State isClickScrollBar: boolean = false; @StorageLink('PhotoGridPageIndex') @Watch('onIndexChange') PhotoGridPageIndex: number = Constants.INVALID; @StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode(); diff --git a/product/phone/src/main/ets/pages/VideoBrowser.ets b/product/phone/src/main/ets/pages/VideoBrowser.ets index 367fa9fd..ee4f7864 100644 --- a/product/phone/src/main/ets/pages/VideoBrowser.ets +++ b/product/phone/src/main/ets/pages/VideoBrowser.ets @@ -44,8 +44,8 @@ struct VideoBrowser { @Provide('dateTitle') photoDate: string = ''; @Provide('timeLocationTitle') timeAndLocation: string = ''; @Provide isShowBar: boolean = false; - @Provide menuList: Array = new Array(); - @Provide moreMenuList: Array = new Array(); + @Provide menuList: Action[] = []; + @Provide moreMenuList: Action[] = []; @Provide hidePopup: boolean = false; private broadCast: BroadCast = new BroadCast(); private myVideoController: VideoController = new VideoController(); diff --git a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets index c917268a..588a9ec5 100644 --- a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets +++ b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets @@ -111,10 +111,10 @@ export struct PhotoBrowserComponent { @Provide backgroundColorResource: Resource = $r('app.color.default_background_color'); @Provide('dateTitle') photoDate: string = ''; @Provide('timeLocationTitle') timeAndLocation: string = ''; - @Provide menuList: Array = new Array(); - @Provide toolMenuList: Array = new Array(); - @Provide topMenuList: Array = new Array(); - @Provide moreMenuList: Array = new Array(); + @Provide menuList: Action[] = []; + @Provide toolMenuList: Action[] = []; + @Provide topMenuList: Action[] = []; + @Provide moreMenuList: Action[] = []; @Provide broadCast: BroadCast = new BroadCast(); @Provide isShowBar: boolean = true; @Provide onlyChangeBgColor: boolean = false; @@ -471,7 +471,7 @@ export struct PhotoBrowserComponent { Log.info(TAG, `updateMenu album[${this.albumUri}]`); - let menuTemp: Array = new Array(); + let menuTemp: Action[] = []; if (this.pageFrom == Constants.ENTRY_FROM.CAMERA || this.pageFrom == Constants.ENTRY_FROM.CARD || (this.isFromViewDataWithMediaUri == true && @@ -487,7 +487,7 @@ export struct PhotoBrowserComponent { this.menuList = menuTemp; } - let list: Array = new Array(); + let list: Action[] = []; if (pageFrom === Constants.ENTRY_FROM.NORMAL || pageFrom === Constants.ENTRY_FROM.CAMERA) { list.push(currentPhoto.isFavor ? Action.FAVORITE : Action.NOT_FAVORITE, ((currentPhoto.mediaType == UserFileManagerAccess.MEDIA_TYPE_IMAGE)) diff --git a/product/phone/src/main/ets/view/PhotoGridView.ets b/product/phone/src/main/ets/view/PhotoGridView.ets index 0567a832..c7aaed0e 100644 --- a/product/phone/src/main/ets/view/PhotoGridView.ets +++ b/product/phone/src/main/ets/view/PhotoGridView.ets @@ -82,8 +82,8 @@ export struct PhotoGridView { @Provide broadCast: BroadCast = new BroadCast(); @Consume isShow: boolean; @Provide isShowBar: boolean = true; - @Provide moreMenuList: Array = new Array(); - @Provide rightClickMenuList: Array = new Array(); + @Provide moreMenuList: Action[] = []; + @Provide rightClickMenuList: Action[] = []; @StorageLink('PhotoGridPageIndex') @Watch('onIndexChange') PhotoGridPageIndex: number = Constants.INVALID; @StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode(); @StorageLink('leftBlank') leftBlank: number[] = @@ -519,7 +519,7 @@ export struct PhotoGridView { if (!this.isSelectedMode) { this.onModeChange(); } - this.rightClickMenuList = new Array(); + this.rightClickMenuList = []; if (this.albumInfo) { let isRecycleAlbum: boolean = this.albumInfo.isTrashAlbum; if (isRecycleAlbum) { From 341845880ab7cda1ddde652c155f4a2b7897120b Mon Sep 17 00:00:00 2001 From: liujuan Date: Thu, 30 May 2024 17:14:55 +0800 Subject: [PATCH 2/5] Signed-off-by: liujuan Changes to be committed: --- .../src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets | 2 +- product/phone/src/main/ets/pages/FormEditorPage.ets | 2 +- product/phone/src/main/ets/pages/index.ets | 2 +- product/phone/src/main/ets/view/PhotoBrowserComponent.ets | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets b/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets index a4b076cf..904ba9ae 100644 --- a/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets +++ b/feature/thirdselect/src/main/ets/default/view/ThirdSelectPhotoBrowserBase.ets @@ -848,7 +848,7 @@ export struct ThirdSelectPhotoBrowserBase { } return; } - let uriArray: Array; + let uriArray: string[] = []; let mediaType: number; if (this.isMultiPick) { if (this.selectManager === null) { diff --git a/product/phone/src/main/ets/pages/FormEditorPage.ets b/product/phone/src/main/ets/pages/FormEditorPage.ets index e8b09b97..b56744cc 100644 --- a/product/phone/src/main/ets/pages/FormEditorPage.ets +++ b/product/phone/src/main/ets/pages/FormEditorPage.ets @@ -69,7 +69,7 @@ struct FormEditorPage { async getItems(albumUri?: string, startIndex?: number, count?: number, filterMediaType?: string): Promise> { - let result: Array = []; + let result: userFileManager.FileAsset[] = []; // Get from target album if albumUri is not undefined, otherwise getAllObject if (albumUri) { diff --git a/product/phone/src/main/ets/pages/index.ets b/product/phone/src/main/ets/pages/index.ets index 040b5532..22aef136 100644 --- a/product/phone/src/main/ets/pages/index.ets +++ b/product/phone/src/main/ets/pages/index.ets @@ -378,7 +378,7 @@ struct IndexPage { } Log.info(TAG, `Has permission been requested? ${isRequested}`); if (!isRequested) { - let permissionList: Array = [ + let permissionList: string[] = [ 'ohos.permission.READ_IMAGEVIDEO', 'ohos.permission.WRITE_IMAGEVIDEO', 'ohos.permission.MEDIA_LOCATION' diff --git a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets index 588a9ec5..cc799811 100644 --- a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets +++ b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets @@ -516,7 +516,7 @@ export struct PhotoBrowserComponent { this.toolMenuList = []; } } - let menuTempList: Array; + let menuTempList: Action[] = []; if (!this.albumInfo) { // 照片页 menuTempList = [Action.ADD, Action.RENAME]; From e6a06712a0e6ad38414179f634c3bfea68fdd5a1 Mon Sep 17 00:00:00 2001 From: liujuan Date: Thu, 30 May 2024 17:47:17 +0800 Subject: [PATCH 3/5] Signed-off-by: liujuan Changes to be committed: --- .../default/model/common/HistogramManager.ets | 10 +-- common/src/main/ets/default/view/TabBar.ets | 16 ++--- .../main/ets/default/view/CropRulerBar.ets | 70 +++++++++---------- .../main/ets/default/view/PcCropRulerBar.ets | 60 ++++++++-------- .../src/main/ets/default/view/ToolBar.ets | 4 +- .../src/main/ets/view/TimelinePage.ets | 12 ++-- .../phone/src/main/ets/pages/NewAlbumPage.ets | 12 ++-- .../src/main/ets/pages/PhotoGridPage.ets | 2 +- .../main/ets/view/PhotoBrowserComponent.ets | 28 ++++---- .../phone/src/main/ets/view/PhotoGridView.ets | 12 ++-- 10 files changed, 113 insertions(+), 113 deletions(-) diff --git a/common/src/main/ets/default/model/common/HistogramManager.ets b/common/src/main/ets/default/model/common/HistogramManager.ets index f3226372..079d9fcd 100644 --- a/common/src/main/ets/default/model/common/HistogramManager.ets +++ b/common/src/main/ets/default/model/common/HistogramManager.ets @@ -221,21 +221,21 @@ export class HistogramManager { private drawSingleHistogram(array: Uint32Array, color: string): void { let width = this.width; let height = this.height; - const start_axis: number = 0; + const startAxis: number = 0; let peakPoint: number = Math.max(...array); if (peakPoint === 0) { Log.warn(TAG, 'peakPoint is zero'); return; } - let x_step = width / Constants.PIXEL_NUMBER; - let y_step = height / peakPoint; + let xStep = width / Constants.PIXEL_NUMBER; + let yStep = height / peakPoint; let region = new Path2D(); // 移动到起始位置 region.moveTo(start_axis, height); let last = 0; for (let pixelValue = 0; pixelValue < array.length; pixelValue++) { - let v1 = pixelValue * x_step; - let v2 = y_step * array[pixelValue]; + let v1 = pixelValue * xStep; + let v2 = yStep * array[pixelValue]; let value = height - v2; region.lineTo(v1, value); last = v1; diff --git a/common/src/main/ets/default/view/TabBar.ets b/common/src/main/ets/default/view/TabBar.ets index 40fe5cfd..9a82e964 100644 --- a/common/src/main/ets/default/view/TabBar.ets +++ b/common/src/main/ets/default/view/TabBar.ets @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ export enum DeviceType { PC_LIKE } -const TabMap = [ +const tabMap = [ BigDataConstants.PHOTO_TAB, BigDataConstants.ALBUM_TAB ] @@ -168,7 +168,7 @@ export struct TabBar { tab.isSelected = false; } }) - let currentTab: string = TabMap[this.currentIndex] ? TabMap[this.currentIndex] : BigDataConstants.PHOTO_TAB; + let currentTab: string = tabMap[this.currentIndex] ? tabMap[this.currentIndex] : BigDataConstants.PHOTO_TAB; interface Msg { switchTab: string; current: string; @@ -355,18 +355,18 @@ export struct TabBarForAlbumSet { struct TabWithText { @Consume isAlbumSetSelectedMode: boolean; @ObjectLink tabItemWithText: TabItemWithText; - @State TabWidth: number = 0; + @State tabWidth: number = 0; index: number = 0; onTabSelected?: Function; aboutToAppear(): void { // Determine the length of the underline based on the font length if (this.index == 0) { - this.TabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 2; + this.tabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 2; } else { - this.TabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 4; + this.tabWidth = px2vp(fp2px(Constants.TEXT_SIZE_SUB_TITLE2)) * 4; } - Log.info(TAG, `index is ${this.index} and TabWidth is ${this.TabWidth}`); + Log.info(TAG, `index is ${this.index} and tabWidth is ${this.tabWidth}`); } build() { @@ -385,7 +385,7 @@ struct TabWithText { right: $r('app.float.single_tab_margin'), bottom: $r('app.float.tab_bar_line_margin_top') }) Column() - .width(this.TabWidth) + .width(this.tabWidth) .height($r('app.float.tab_bar_line_height')) .borderRadius($r('app.float.tab_bar_line_radius')) .backgroundColor(this.tabItemWithText.getTextColor()) diff --git a/feature/editor/src/main/ets/default/view/CropRulerBar.ets b/feature/editor/src/main/ets/default/view/CropRulerBar.ets index a9a82038..61e5fc4b 100644 --- a/feature/editor/src/main/ets/default/view/CropRulerBar.ets +++ b/feature/editor/src/main/ets/default/view/CropRulerBar.ets @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ export struct CropRulerBar { @State rulerWidth: number = Constants.NUMBER_0; @Consume('verticalScreen') isVerticalScreen: boolean; private screenManager = ScreenManager.getInstance(); - private current_def: number = Constants.NUMBER_0; + private currentDef: number = Constants.NUMBER_0; private startPos: number = Constants.NUMBER_0; private setting: RenderingContextSettings = new RenderingContextSettings(true); private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.setting); @@ -73,30 +73,30 @@ export struct CropRulerBar { } drawMidLine(): void { - const mid_x = Math.floor(this.rulerLength / Constants.NUMBER_2); + const midX= Math.floor(this.rulerLength / Constants.NUMBER_2); this.context.beginPath(); this.context.fillStyle = Constants.RULER_FILL_STYLE_100; if (this.isVerticalScreen) { - this.context.fillRect(mid_x - Constants.MID_LINE_WIDTH / Constants.NUMBER_2, + this.context.fillRect(midX- Constants.MID_LINE_WIDTH / Constants.NUMBER_2, this.rulerWidth * Constants.NUMBER_8 / Constants.NUMBER_15, Constants.MID_LINE_WIDTH, Constants.MID_LINE_HEIGHT); } else { this.context.fillRect(this.rulerWidth * Constants.NUMBER_8_5 / Constants.NUMBER_15, - mid_x - Constants.MID_LINE_WIDTH / Constants.NUMBER_2, Constants.MID_LINE_HEIGHT, + midX- Constants.MID_LINE_WIDTH / Constants.NUMBER_2, Constants.MID_LINE_HEIGHT, Constants.MID_LINE_WIDTH); } this.context.stroke(); this.context.closePath(); } - drawIntegerLine(cur_x: number, cur_num: number): void { + drawIntegerLine(curX: number, curNum: number): void { if (!this.isVerticalScreen) { - this.context.moveTo((this.rulerWidth * 8.5) / 15, cur_x); + this.context.moveTo((this.rulerWidth * 8.5) / 15, curX); } else { - this.context.moveTo(cur_x, (this.rulerWidth * 8.5) / 15); + this.context.moveTo(curX, (this.rulerWidth * 8.5) / 15); } - if (Math.abs(cur_num) > Constants.EDGE_ANGLE) { + if (Math.abs(curNum) > Constants.EDGE_ANGLE) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_40; this.context.shadowColor = Constants.RULER_FILL_STYLE_40; } else { @@ -104,38 +104,38 @@ export struct CropRulerBar { this.context.shadowColor = Constants.RULER_FILL_STYLE_90; } this.context.shadowBlur = Constants.RULER_LINE_WIDTH - if (Math.round(cur_num) == Math.round(this.current_def)) { + if (Math.round(curNum) == Math.round(this.current_def)) { if (!this.isVerticalScreen) { - this.context.fillText(this.integerAngleToString(Math.round(cur_num)) as string, - (this.rulerWidth * 6) / 15, cur_x); + this.context.fillText(this.integerAngleToString(Math.round(curNum)) as string, + (this.rulerWidth * 6) / 15, curX); } else { - this.context.fillText(this.integerAngleToString(Math.round(cur_num)) as string, cur_x, + this.context.fillText(this.integerAngleToString(Math.round(curNum)) as string, curX, (this.rulerWidth * 6) / 15); } } else { if (!this.isVerticalScreen) { - this.context.fillText((-cur_num).toString(), - (this.rulerWidth * 6) / 15, cur_x); + this.context.fillText((-curNum).toString(), + (this.rulerWidth * 6) / 15, curX); } else { - this.context.fillText(cur_num.toString(), cur_x, + this.context.fillText(curNum.toString(), curX, (this.rulerWidth * 6) / 15); } } if (!this.isVerticalScreen) { - this.context.lineTo(this.rulerWidth * 10.5 / 15, cur_x); + this.context.lineTo(this.rulerWidth * 10.5 / 15, curX); } else { - this.context.lineTo(cur_x, this.rulerWidth * 10.5 / 15); + this.context.lineTo(curX, this.rulerWidth * 10.5 / 15); } } drawLine(): void { - let begin_num = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; - let cur_x = 0; - let cur_num = 0; - const scale_len = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1; - for (let i = 0; i < scale_len; i++) { - cur_num = begin_num + i; + let beginNum = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; + let curX = 0; + let curNum = 0; + const scaleLen = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1; + for (let i = 0; i < scaleLen; i++) { + curNum = beginNum + i; this.context.beginPath(); this.multiScreenAdaptation(); this.context.textAlign = 'center'; @@ -143,7 +143,7 @@ export struct CropRulerBar { this.context.textAlign = 'end'; this.context.textBaseline = 'middle'; } - if (Math.abs(cur_num) > Constants.EDGE_ANGLE) { + if (Math.abs(curNum) > Constants.EDGE_ANGLE) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_40; this.context.fillStyle = Constants.RULER_FILL_STYLE_40; } else { @@ -151,24 +151,24 @@ export struct CropRulerBar { this.context.fillStyle = Constants.RULER_FILL_STYLE_90; } this.context.shadowBlur = 0; - cur_x = i * Constants.NUMBER_5; - if (cur_x == 0 || cur_x == this.rulerLength) { + curX = i * Constants.NUMBER_5; + if (curX == 0 || curX == this.rulerLength) { this.context.lineWidth = (Constants.RULER_LINE_WIDTH / Constants.NUMBER_2); - if (cur_x < 0) { - cur_x = 0; + if (curX < 0) { + curX = 0; } } else { this.context.lineWidth = Constants.RULER_LINE_WIDTH; } - if (Math.round(Math.abs(cur_num)) % Constants.NUMBER_10 == 0) { - this.drawIntegerLine(cur_x, cur_num); + if (Math.round(Math.abs(curNum)) % Constants.NUMBER_10 == 0) { + this.drawIntegerLine(curX, curNum); } else { if (!this.isVerticalScreen) { - this.context.moveTo((this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15, cur_x); - this.context.lineTo(this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15, cur_x); + this.context.moveTo((this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15, curX); + this.context.lineTo(this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15, curX); } else { - this.context.moveTo(cur_x, (this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15); - this.context.lineTo(cur_x, this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15); + this.context.moveTo(curX, (this.rulerWidth * Constants.NUMBER_9_5) / Constants.NUMBER_15); + this.context.lineTo(curX, this.rulerWidth * Constants.NUMBER_10_5 / Constants.NUMBER_15); } } this.context.stroke(); diff --git a/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets b/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets index 959f97c3..659df3a2 100644 --- a/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets +++ b/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ export struct PcCropRulerBar { @Consume broadCast: BroadCast; @State cWidth: number = 250; @State cHeight: number = 57; - private current_def: number = 0; + private currentDef: number = 0; private startPos: number = 0; private setting: RenderingContextSettings = new RenderingContextSettings(true); private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.setting); @@ -55,7 +55,7 @@ export struct PcCropRulerBar { drawMidLine() { // 中点 - const mid_x = Math.floor(this.rulerLength / Constants.NUMBER_2); + const midX= Math.floor(this.rulerLength / Constants.NUMBER_2); this.context.beginPath(); this.context.fillStyle = Constants.RULER_FILL_STYLE_100; this.context.strokeStyle = Constants.RULER_FILL_STYLE_100; @@ -69,28 +69,28 @@ export struct PcCropRulerBar { this.context.closePath(); } - drawIntegerLine(cur_x: number, cur_num: number) { - this.context.moveTo(cur_x, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); + drawIntegerLine(curX: number, curNum: number) { + this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); this.context.shadowBlur = Constants.RULER_LINE_WIDTH this.context.lineCap = 'round'; - if (Math.round(cur_num) != Math.round(this.current_def) && Math.round(cur_num) == 0) { + if (Math.round(curNum) != Math.round(this.current_def) && Math.round(curNum) == 0) { this.context.textBaseline = 'bottom' this.context.font = Constants.RULER_CONTEXT_FONT_25PX; - this.context.fillText(cur_num.toString(), cur_x, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); + this.context.fillText(curNum.toString(), curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); } - this.context.lineTo(cur_x, this.rulerDrawHeight); + this.context.lineTo(curX, this.rulerDrawHeight); } drawLine() { // 起始绘制位置 - let begin_num = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; - let end_num = this.current_def + (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; - let cur_x = 0; - let cur_num = 0; - const scale_len = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1; - for (let i = 0; i < scale_len; i++) { - cur_num = begin_num + i; + let beginNum = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; + let endNum = this.current_def + (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; + let curX = 0; + let curNum = 0; + const scaleLen = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1; + for (let i = 0; i < scaleLen; i++) { + curNum = beginNum + i; this.context.beginPath(); this.multiScreenAdaptation(); this.context.textAlign = 'center'; @@ -100,24 +100,24 @@ export struct PcCropRulerBar { this.context.fillStyle = Constants.RULER_FILL_STYLE_40; // 边缘第三根线 - if (cur_num <= (begin_num + Constants.NUMBER_3) || cur_num >= (end_num - Constants.NUMBER_3)) { + if (curNum <= (beginNum + Constants.NUMBER_3) || curNum >= (end_num - Constants.NUMBER_3)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_30; this.context.fillStyle = Constants.RULER_FILL_STYLE_30; } // 次边缘的线 - if (cur_num <= (begin_num + Constants.NUMBER_2) || cur_num >= (end_num - Constants.NUMBER_2)) { + if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (end_num - Constants.NUMBER_2)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_20; this.context.fillStyle = Constants.RULER_FILL_STYLE_20; } // 最边缘的线 - if (cur_num <= (begin_num + Constants.NUMBER_2) || cur_num >= (end_num - Constants.NUMBER_2)) { + if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (end_num - Constants.NUMBER_2)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_10; this.context.fillStyle = Constants.RULER_FILL_STYLE_10; } // 标尺0与当前数值之间的白色竖线 - if ((cur_num < this.current_def && cur_num >= 0) || (cur_num > this.current_def && cur_num <= 0)) { + if ((curNum < this.current_def && curNum >= 0) || (curNum > this.current_def && curNum <= 0)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_100; this.context.fillStyle = Constants.RULER_FILL_STYLE_100; } @@ -125,29 +125,29 @@ export struct PcCropRulerBar { // 设置线宽 this.context.shadowBlur = 0; this.context.lineCap = 'round'; - cur_x = i * Constants.NUMBER_5 - if (cur_x == 0 || cur_x == this.rulerLength) { + curX = i * Constants.NUMBER_5 + if (curX == 0 || curX == this.rulerLength) { // 边界位置刻度线宽度为一半 this.context.lineWidth = (Constants.RULER_LINE_WIDTH / Constants.NUMBER_2); - if (cur_x < 0) { - cur_x = 0; + if (curX < 0) { + curX = 0; } } else { this.context.lineWidth = Constants.RULER_LINE_WIDTH; } // 绘制刻度线 - if (Math.abs(cur_num) % Constants.NUMBER_10 === 0) { + if (Math.abs(curNum) % Constants.NUMBER_10 === 0) { // 每隔10个刻度绘制一个中刻度线 - this.drawIntegerLine(cur_x, cur_num) - } else if ((cur_num < this.current_def && cur_num >= 0) || (cur_num > this.current_def && cur_num <= 0)) { + this.drawIntegerLine(curX, curNum) + } else if ((curNum < this.current_def && curNum >= 0) || (curNum > this.current_def && curNum <= 0)) { // 0和当前刻度之间的线 - this.context.moveTo(cur_x, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); - this.context.lineTo(cur_x, this.rulerDrawHeight); + this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); + this.context.lineTo(curX, this.rulerDrawHeight); } else { // 其他短刻度线 - this.context.moveTo(cur_x, this.rulerDrawHeight - Constants.EDITOR_SMALL_TICK_LINE_HEIGHT); - this.context.lineTo(cur_x, this.rulerDrawHeight); + this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_SMALL_TICK_LINE_HEIGHT); + this.context.lineTo(curX, this.rulerDrawHeight); } this.context.stroke(); this.context.closePath(); diff --git a/feature/editor/src/main/ets/default/view/ToolBar.ets b/feature/editor/src/main/ets/default/view/ToolBar.ets index df276f2b..c560dcfa 100644 --- a/feature/editor/src/main/ets/default/view/ToolBar.ets +++ b/feature/editor/src/main/ets/default/view/ToolBar.ets @@ -22,7 +22,7 @@ import { PhotoEditorManager } from '../PhotoEditorManager'; const TAG: string = 'editor_ToolBar'; -const COMPONENT_KEY_Edit_CROP: string = 'EditToolBarCrop'; +const ComPonentKeyEditCrop: string = 'EditToolBarCrop'; @Component export struct ToolBar { @@ -48,7 +48,7 @@ export struct ToolBar { actionID: undefined, text: $r('app.string.crop_text'), isActive: true, - componentKey: COMPONENT_KEY_Edit_CROP + componentKey: ComPonentKeyEditCrop }) ]; /** diff --git a/feature/timeline/src/main/ets/view/TimelinePage.ets b/feature/timeline/src/main/ets/view/TimelinePage.ets index 9a412dda..3bdd621d 100644 --- a/feature/timeline/src/main/ets/view/TimelinePage.ets +++ b/feature/timeline/src/main/ets/view/TimelinePage.ets @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ import { TimelineDataSourceManager } from '../model/TimelineDataSourceManager'; import { TimelineScrollBar } from './TimelineScrollBar'; const TAG: string = 'TimelinePage'; -AppStorage.setOrCreate('TimelinePageIndex', Constants.INVALID); +AppStorage.setOrCreate('timelinePageIndex', Constants.INVALID); interface Params { albumName: string; @@ -76,7 +76,7 @@ export struct TimelinePage { @State totalSelectedCount: number = 0; @Provide broadCast: BroadCast = TimelineDataSourceManager.getInstance().getBroadCast(); @Consume @Watch('onIndexPageShow') isShow: boolean; - @StorageLink('TimelinePageIndex') @Watch('onIndexChange') TimelinePageIndex: number = Constants.INVALID; + @StorageLink('timelinePageIndex') @Watch('onIndexChange') timelinePageIndex: number = Constants.INVALID; @StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode(); @StorageLink('leftBlank') leftBlank: number[] = [0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()]; @@ -441,9 +441,9 @@ export struct TimelinePage { } onIndexChange(): void { - Log.info(TAG, `onIndexChange ${this.TimelinePageIndex}`); - if (this.TimelinePageIndex != Constants.INVALID && this.dataSource != null) { - this.scroller.scrollToIndex(this.dataSource.getPositionByIndex(this.TimelinePageIndex)); + Log.info(TAG, `onIndexChange ${this.timelinePageIndex}`); + if (this.timelinePageIndex != Constants.INVALID && this.dataSource != null) { + this.scroller.scrollToIndex(this.dataSource.getPositionByIndex(this.timelinePageIndex)); } } diff --git a/product/phone/src/main/ets/pages/NewAlbumPage.ets b/product/phone/src/main/ets/pages/NewAlbumPage.ets index b1dc8b27..5a05baf7 100644 --- a/product/phone/src/main/ets/pages/NewAlbumPage.ets +++ b/product/phone/src/main/ets/pages/NewAlbumPage.ets @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ import { PhotoBrowserComponent } from '../view/PhotoBrowserComponent'; import { SelectPhotoBrowserView } from '../view/SelectPhotoBrowserView'; const TAG: string = 'NewAlbumPage'; -AppStorage.setOrCreate('PhotoGridPageIndex', Constants.INVALID); +AppStorage.setOrCreate('photoGridPageIndex', Constants.INVALID); interface Params { item: string; @@ -66,7 +66,7 @@ export struct NewAlbumPage { @State moreMenuList: Action[] = []; @Provide rightClickMenuList: Action[] = []; @State isClickScrollBar: boolean = false; - @StorageLink('PhotoGridPageIndex') @Watch('onIndexChange') PhotoGridPageIndex: number = Constants.INVALID; + @StorageLink('photoGridPageIndex') @Watch('onIndexChange') photoGridPageIndex: number = Constants.INVALID; @StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode(); @StorageLink('leftBlank') leftBlank: number[] = [0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()]; @@ -159,9 +159,9 @@ export struct NewAlbumPage { } onIndexChange() { - Log.info(TAG, `onIndexChange ${this.PhotoGridPageIndex}`) - if (this.PhotoGridPageIndex != Constants.INVALID) { - this.scroller.scrollToIndex(this.PhotoGridPageIndex); + Log.info(TAG, `onIndexChange ${this.photoGridPageIndex}`) + if (this.photoGridPageIndex != Constants.INVALID) { + this.scroller.scrollToIndex(this.photoGridPageIndex); } } diff --git a/product/phone/src/main/ets/pages/PhotoGridPage.ets b/product/phone/src/main/ets/pages/PhotoGridPage.ets index 1608dd22..7c792334 100644 --- a/product/phone/src/main/ets/pages/PhotoGridPage.ets +++ b/product/phone/src/main/ets/pages/PhotoGridPage.ets @@ -29,7 +29,7 @@ import { SelectPhotoBrowserView } from '../view/SelectPhotoBrowserView'; import { LEFT_BLANK } from '@ohos/thirdselect/src/main/ets/default/utils/ThirdSelectConstants'; const TAG: string = 'PhotoGridPage'; -AppStorage.setOrCreate('PhotoGridPageIndex', Constants.INVALID); +AppStorage.setOrCreate('photoGridPageIndex', Constants.INVALID); // Album Page @Entry diff --git a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets index cc799811..7925cd1d 100644 --- a/product/phone/src/main/ets/view/PhotoBrowserComponent.ets +++ b/product/phone/src/main/ets/view/PhotoBrowserComponent.ets @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -123,8 +123,8 @@ export struct PhotoBrowserComponent { @State @Watch('updateMoreMenu') currentShow: boolean = true; @StorageLink('isHorizontal') @Watch('updateIsHorizontal') isHorizontal: boolean = ScreenManager.getInstance() .isHorizontal(); - @StorageLink('TimelinePageIndex') TimelinePageIndex: number = Constants.INVALID; - @StorageLink('PhotoGridPageIndex') PhotoGridPageIndex: number = Constants.INVALID; + @StorageLink('timelinePageIndex') timelinePageIndex: number = Constants.INVALID; + @StorageLink('photoGridPageIndex') photoGridPageIndex: number = Constants.INVALID; @StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode(); @StorageLink('leftBlank') leftBlank: number[] = [0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()]; @@ -610,12 +610,12 @@ export struct PhotoBrowserComponent { this.dataSource.release(); if (this.checkedTransition === Constants.PHOTO_TRANSITION_TIMELINE) { Log.info(TAG, 'onBackPress TimelinePage'); - this.TimelinePageIndex = this.currentIndex; // call scrollTo - this.TimelinePageIndex = Constants.INVALID; + this.timelinePageIndex = this.currentIndex; // call scrollTo + this.timelinePageIndex = Constants.INVALID; } else if (this.checkedTransition === Constants.PHOTO_TRANSITION_ALBUM) { Log.info(TAG, 'onBackPress PhotoGridPage'); - this.PhotoGridPageIndex = this.currentIndex; // call scrollTo - this.PhotoGridPageIndex = Constants.INVALID; + this.photoGridPageIndex = this.currentIndex; // call scrollTo + this.photoGridPageIndex = Constants.INVALID; if (this.isFromFACard) { if (this.isPullDown) { @@ -1138,11 +1138,11 @@ export struct PhotoBrowserComponent { Log.info(TAG, `data reloaded move to ${index}`); this.currentIndex = index; if (this.checkedTransition == Constants.PHOTO_TRANSITION_TIMELINE) { - this.TimelinePageIndex = this.currentIndex; // call scrollTo - this.TimelinePageIndex = Constants.INVALID; + this.timelinePageIndex = this.currentIndex; // call scrollTo + this.timelinePageIndex = Constants.INVALID; } else if (this.checkedTransition == Constants.PHOTO_TRANSITION_ALBUM) { - this.PhotoGridPageIndex = this.currentIndex; // call scrollTo - this.PhotoGridPageIndex = Constants.INVALID; + this.photoGridPageIndex = this.currentIndex; // call scrollTo + this.photoGridPageIndex = Constants.INVALID; } this.dataSource.enableGetData(true); this.dataSource.getData(this.currentIndex); @@ -1361,12 +1361,12 @@ export struct PhotoBrowserComponent { } interface Msg { clickThumbnailTime: number; - ShowSinglePhoto: number; - FileName?: string; + showSinglePhoto: number; + fileName?: string; } let msg: Msg = { clickThumbnailTime: this.clickThumbnailTime, - ShowSinglePhoto: Date.now() + showSinglePhoto: Date.now() } let fileName = ReportToBigDataUtil.getFileNameOfPhotoTakenByCamera(this.getPhotoByIndex(0)); ReportToBigDataUtil.setFileNameProperty(msg, fileName); diff --git a/product/phone/src/main/ets/view/PhotoGridView.ets b/product/phone/src/main/ets/view/PhotoGridView.ets index c7aaed0e..e1ddec26 100644 --- a/product/phone/src/main/ets/view/PhotoGridView.ets +++ b/product/phone/src/main/ets/view/PhotoGridView.ets @@ -1,4 +1,4 @@ -/* +/** * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ import { const TAG: string = 'PhotoGridView'; -AppStorage.setOrCreate('PhotoGridPageIndex', Constants.INVALID); +AppStorage.setOrCreate('photoGridPageIndex', Constants.INVALID); // Album View @Component @@ -84,7 +84,7 @@ export struct PhotoGridView { @Provide isShowBar: boolean = true; @Provide moreMenuList: Action[] = []; @Provide rightClickMenuList: Action[] = []; - @StorageLink('PhotoGridPageIndex') @Watch('onIndexChange') PhotoGridPageIndex: number = Constants.INVALID; + @StorageLink('photoGridPageIndex') @Watch('onIndexChange') photoGridPageIndex: number = Constants.INVALID; @StorageLink('isSplitMode') isSplitMode: boolean = ScreenManager.getInstance().isSplitMode(); @StorageLink('leftBlank') leftBlank: number[] = [0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()]; @@ -144,9 +144,9 @@ export struct PhotoGridView { } onIndexChange(): void { - Log.info(TAG, `onIndexChange ${this.PhotoGridPageIndex}`) - if (this.PhotoGridPageIndex != Constants.INVALID) { - this.scroller.scrollToIndex(this.PhotoGridPageIndex); + Log.info(TAG, `onIndexChange ${this.photoGridPageIndex}`) + if (this.photoGridPageIndex != Constants.INVALID) { + this.scroller.scrollToIndex(this.photoGridPageIndex); } } From b05cecd4bdc753a272b77421a73a58805cc8e086 Mon Sep 17 00:00:00 2001 From: liujuan Date: Thu, 30 May 2024 11:20:52 +0000 Subject: [PATCH 4/5] update feature/editor/src/main/ets/default/view/CropRulerBar.ets. Signed-off-by: liujuan --- .../src/main/ets/default/view/CropRulerBar.ets | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/feature/editor/src/main/ets/default/view/CropRulerBar.ets b/feature/editor/src/main/ets/default/view/CropRulerBar.ets index 61e5fc4b..30b62a8f 100644 --- a/feature/editor/src/main/ets/default/view/CropRulerBar.ets +++ b/feature/editor/src/main/ets/default/view/CropRulerBar.ets @@ -104,7 +104,7 @@ export struct CropRulerBar { this.context.shadowColor = Constants.RULER_FILL_STYLE_90; } this.context.shadowBlur = Constants.RULER_LINE_WIDTH - if (Math.round(curNum) == Math.round(this.current_def)) { + if (Math.round(curNum) == Math.round(this.currentDef)) { if (!this.isVerticalScreen) { this.context.fillText(this.integerAngleToString(Math.round(curNum)) as string, (this.rulerWidth * 6) / 15, curX); @@ -130,7 +130,7 @@ export struct CropRulerBar { } drawLine(): void { - let beginNum = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; + let beginNum = this.currentDef - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; let curX = 0; let curNum = 0; const scaleLen = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1; @@ -194,17 +194,17 @@ export struct CropRulerBar { if (Math.abs(dir / 5) < 1) { return; } - this.current_def += Number.parseInt((dir / 5).toFixed(0)); + this.currentDef += Number.parseInt((dir / 5).toFixed(0)); this.startPos = event.touches[0][axis]; - if (Math.abs(this.current_def) > Constants.EDGE_ANGLE) { - this.current_def = this.current_def > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE; + if (Math.abs(this.currentDef) > Constants.EDGE_ANGLE) { + this.currentDef = this.currentDef > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE; } this.drawRuler(); - this.broadCast.emit(Constants.RULER_CHANGED, [this.current_def]); + this.broadCast.emit(Constants.RULER_CHANGED, [this.currentDef]); } onResetClicked(): void { - this.current_def = Constants.NUMBER_0; + this.currentDef = Constants.NUMBER_0; this.drawRuler(); } From c6b9ca7cfa541c11cc655edde204c98f46dd168d Mon Sep 17 00:00:00 2001 From: liujuan Date: Thu, 30 May 2024 11:21:30 +0000 Subject: [PATCH 5/5] update feature/editor/src/main/ets/default/view/PcCropRulerBar.ets. Signed-off-by: liujuan --- .../main/ets/default/view/PcCropRulerBar.ets | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets b/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets index 659df3a2..8edb2f36 100644 --- a/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets +++ b/feature/editor/src/main/ets/default/view/PcCropRulerBar.ets @@ -62,8 +62,8 @@ export struct PcCropRulerBar { this.context.lineCap = 'round'; this.context.lineWidth = Constants.MID_LINE_WIDTH; - this.context.moveTo(mid_x, this.rulerDrawHeight - Constants.EDITOR_LARGE_TICK_LINE_HEIGHT); - this.context.lineTo(mid_x, this.rulerDrawHeight - Constants.NUMBER_1); + this.context.moveTo(midX, this.rulerDrawHeight - Constants.EDITOR_LARGE_TICK_LINE_HEIGHT); + this.context.lineTo(midX, this.rulerDrawHeight - Constants.NUMBER_1); this.context.stroke(); this.context.closePath(); @@ -73,7 +73,7 @@ export struct PcCropRulerBar { this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); this.context.shadowBlur = Constants.RULER_LINE_WIDTH this.context.lineCap = 'round'; - if (Math.round(curNum) != Math.round(this.current_def) && Math.round(curNum) == 0) { + if (Math.round(curNum) != Math.round(this.currentDef) && Math.round(curNum) == 0) { this.context.textBaseline = 'bottom' this.context.font = Constants.RULER_CONTEXT_FONT_25PX; this.context.fillText(curNum.toString(), curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); @@ -84,8 +84,8 @@ export struct PcCropRulerBar { drawLine() { // 起始绘制位置 - let beginNum = this.current_def - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; - let endNum = this.current_def + (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; + let beginNum: number = this.currentDef - (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; + let endNum: number = this.currentDef + (this.rulerLength / Constants.NUMBER_2) / Constants.NUMBER_5; let curX = 0; let curNum = 0; const scaleLen = Math.ceil((this.rulerLength) / Constants.NUMBER_5) + Constants.NUMBER_1; @@ -100,24 +100,24 @@ export struct PcCropRulerBar { this.context.fillStyle = Constants.RULER_FILL_STYLE_40; // 边缘第三根线 - if (curNum <= (beginNum + Constants.NUMBER_3) || curNum >= (end_num - Constants.NUMBER_3)) { + if (curNum <= (beginNum + Constants.NUMBER_3) || curNum >= (endNum - Constants.NUMBER_3)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_30; this.context.fillStyle = Constants.RULER_FILL_STYLE_30; } // 次边缘的线 - if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (end_num - Constants.NUMBER_2)) { + if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (endNum - Constants.NUMBER_2)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_20; this.context.fillStyle = Constants.RULER_FILL_STYLE_20; } // 最边缘的线 - if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (end_num - Constants.NUMBER_2)) { + if (curNum <= (beginNum + Constants.NUMBER_2) || curNum >= (endNum - Constants.NUMBER_2)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_10; this.context.fillStyle = Constants.RULER_FILL_STYLE_10; } // 标尺0与当前数值之间的白色竖线 - if ((curNum < this.current_def && curNum >= 0) || (curNum > this.current_def && curNum <= 0)) { + if ((curNum < this.currentDef && curNum >= 0) || (curNum > this.currentDef && curNum <= 0)) { this.context.strokeStyle = Constants.RULER_FILL_STYLE_100; this.context.fillStyle = Constants.RULER_FILL_STYLE_100; } @@ -140,7 +140,7 @@ export struct PcCropRulerBar { if (Math.abs(curNum) % Constants.NUMBER_10 === 0) { // 每隔10个刻度绘制一个中刻度线 this.drawIntegerLine(curX, curNum) - } else if ((curNum < this.current_def && curNum >= 0) || (curNum > this.current_def && curNum <= 0)) { + } else if ((curNum < this.currentDef && curNum >= 0) || (curNum > this.currentDef && curNum <= 0)) { // 0和当前刻度之间的线 this.context.moveTo(curX, this.rulerDrawHeight - Constants.EDITOR_MIDDLE_TICK_LINE_HEIGHT); this.context.lineTo(curX, this.rulerDrawHeight); @@ -172,17 +172,17 @@ export struct PcCropRulerBar { if (Math.abs(dir / 5) < 1) { return; } - this.current_def += Number.parseInt((dir / 5).toFixed(0)); + this.currentDef += Number.parseInt((dir / 5).toFixed(0)); this.startPos = event.touches[0][axis]; - if (Math.abs(this.current_def) > Constants.EDGE_ANGLE) { - this.current_def = this.current_def > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE; + if (Math.abs(this.currentDef) > Constants.EDGE_ANGLE) { + this.currentDef = this.currentDef > Constants.EDGE_ANGLE ? Constants.EDGE_ANGLE : -Constants.EDGE_ANGLE; } this.drawRuler(); - this.broadCast.emit(Constants.RULER_CHANGED, [this.current_def]); + this.broadCast.emit(Constants.RULER_CHANGED, [this.currentDef]); } onResetClicked() { - this.current_def = 0; + this.currentDef = 0; this.drawRuler(); }