mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-27 01:01:06 +00:00
commit
8ae3e6139b
@ -36,7 +36,7 @@ export struct ImageGridItemComponent {
|
||||
@Consume @Watch('onShow') isShow: boolean;
|
||||
@State autoResize: boolean = true;
|
||||
loaded = false;
|
||||
position: number;
|
||||
imageGridPosition: number;
|
||||
pageName = '';
|
||||
pixelMap: PixelMap;
|
||||
@State useAlt: boolean = false;
|
||||
|
@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -30,7 +30,7 @@ import { LoadingPanel } from './components/LoadingPanel'
|
||||
export struct PhotoItem {
|
||||
@State @Watch('onViewDataChanged') item: MediaItem = new MediaItem(null);
|
||||
@State matrix: any = Matrix4.identity().copy();
|
||||
@State direction: PanDirection = PanDirection.Vertical;
|
||||
@State photoItemDirection: PanDirection = PanDirection.Vertical;
|
||||
@Consume broadCast: BroadCast;
|
||||
@State transitionId: string = PhotoConstants.DEFAULT_TRANSITION_ID;
|
||||
@State objectFit: ImageFit = ImageFit.Contain;
|
||||
@ -40,7 +40,7 @@ export struct PhotoItem {
|
||||
@Consume isPullingDown: boolean;
|
||||
@Consume pageFrom: number;
|
||||
@Consume('transitionIndex') @Watch('onTransitionChange') updateTransition: number;
|
||||
position: number;
|
||||
photoItemPosition: number;
|
||||
transitionTag: string;
|
||||
private eventPipeline: EventPipeline;
|
||||
private logger: Logger = new Logger('PhotoItem');
|
||||
@ -52,9 +52,9 @@ export struct PhotoItem {
|
||||
private preItem = { rotate: 0, height: 0, width: 0 };
|
||||
|
||||
onTransitionChange() {
|
||||
this.logger.info(`onTransitionChange , ${this.updateTransition} ${this.position}`);
|
||||
this.logger.info(`onTransitionChange , ${this.updateTransition} ${this.photoItemPosition}`);
|
||||
this.photoCanRotateCheck();
|
||||
if (this.updateTransition == this.position) {
|
||||
if (this.updateTransition == this.photoItemPosition) {
|
||||
this.transitionId = this.transitionTag + this.item.uri;
|
||||
this.broadCast.emit(PhotoConstants.PHOTO_SHOW_STATE, [!this.showError]);
|
||||
} else {
|
||||
@ -80,7 +80,7 @@ export struct PhotoItem {
|
||||
this.eventPipeline = new EventPipeline(this.broadCast, this.item);
|
||||
this.matrix = Matrix4.identity().copy();
|
||||
this.firstLoad = true;
|
||||
this.isLoading = this.updateTransition == this.position;
|
||||
this.isLoading = this.updateTransition == this.photoItemPosition;
|
||||
// register event handling
|
||||
this.broadCast.on(PhotoConstants.TOUCH_EVENT + this.item.uri, (matrix: any) => {
|
||||
this.matrix = matrix;
|
||||
@ -88,7 +88,7 @@ export struct PhotoItem {
|
||||
|
||||
this.broadCast.on(PhotoConstants.DIRECTION_CHANGE + this.item.uri, (direction: PanDirection) => {
|
||||
this.logger.info(`direction: ${direction}`);
|
||||
this.direction = direction;
|
||||
this.photoItemDirection = direction;
|
||||
});
|
||||
|
||||
this.broadCast.on(PhotoConstants.ANIMATION_EVENT + this.item.uri, (animationOption: any, animationEndMatrix: any) => {
|
||||
@ -102,7 +102,7 @@ export struct PhotoItem {
|
||||
}
|
||||
|
||||
private photoCanRotateCheck() {
|
||||
if (this.updateTransition != this.position) {
|
||||
if (this.updateTransition != this.photoItemPosition) {
|
||||
this.logger.info(`photoCanRotateCheck not current photo`);
|
||||
return
|
||||
}
|
||||
@ -180,20 +180,20 @@ export struct PhotoItem {
|
||||
.transform(this.matrix)
|
||||
.autoResize(false)
|
||||
.onComplete(() => {
|
||||
TraceControllerUtils.startTrace(`PhotoItemComplete_${this.position}`);
|
||||
this.logger.debug(`onComplete finish index: ${this.position}, uri: ${this.item.uri}`);
|
||||
TraceControllerUtils.startTrace(`PhotoItemComplete_${this.photoItemPosition}`);
|
||||
this.logger.debug(`onComplete finish index: ${this.photoItemPosition}, uri: ${this.item.uri}`);
|
||||
this.showError = false;
|
||||
this.isLoading = false;
|
||||
if (this.updateTransition == this.position) {
|
||||
if (this.updateTransition == this.photoItemPosition) {
|
||||
this.broadCast.emit(PhotoConstants.PHOTO_SHOW_STATE, [true]);
|
||||
}
|
||||
TraceControllerUtils.finishTrace(`PhotoItemComplete_${this.position}`);
|
||||
TraceControllerUtils.finishTrace(`PhotoItemComplete_${this.photoItemPosition}`);
|
||||
})
|
||||
.onError(() => {
|
||||
this.logger.error(`image show error`);
|
||||
this.showError = true;
|
||||
this.isLoading = true;
|
||||
if (this.updateTransition == this.position) {
|
||||
if (this.updateTransition == this.photoItemPosition) {
|
||||
this.broadCast.emit(PhotoConstants.PHOTO_SHOW_STATE, [false]);
|
||||
}
|
||||
})
|
||||
@ -255,7 +255,7 @@ export struct PhotoItem {
|
||||
}
|
||||
}),
|
||||
PanGesture({
|
||||
direction: this.direction
|
||||
direction: this.photoItemDirection
|
||||
})
|
||||
.onActionStart((event: GestureEvent) => {
|
||||
this.logger.debug(`PanGesture start offsetX:\
|
||||
|
@ -24,7 +24,7 @@ import { Constants as PhotoConstants } from '../../common/model/browser/photo/Co
|
||||
export struct PhotoSwiper {
|
||||
private dataSource;
|
||||
private logger: Logger = new Logger('PhotoSwiper');
|
||||
transition: string;
|
||||
photoSwiperTransition: string;
|
||||
@Consume currentIndex: number;
|
||||
@Consume broadCast: BroadCast;
|
||||
@Consume canSwipe: boolean;
|
||||
@ -65,11 +65,11 @@ export struct PhotoSwiper {
|
||||
Column() {
|
||||
PhotoItem({
|
||||
item: item.data,
|
||||
position: item.pos,
|
||||
photoItemPosition: item.pos,
|
||||
thumbnail: item.thumbnail,
|
||||
transitionId: (item.pos == this.currentIndex && this.transition != undefined)
|
||||
? (this.transition + item.data.uri) : PhotoConstants.DEFAULT_TRANSITION_ID,
|
||||
transitionTag: this.transition ? this.transition : PhotoConstants.DEFAULT_TRANSITION_ID,
|
||||
transitionId: (item.pos == this.currentIndex && this.photoSwiperTransition != undefined)
|
||||
? (this.photoSwiperTransition + item.data.uri) : PhotoConstants.DEFAULT_TRANSITION_ID,
|
||||
transitionTag: this.photoSwiperTransition ? this.photoSwiperTransition : PhotoConstants.DEFAULT_TRANSITION_ID,
|
||||
})
|
||||
}.zIndex(item.pos == this.currentIndex ? 2 : 1)
|
||||
}, (item) => item.data.uri)
|
||||
|
@ -583,7 +583,7 @@ export struct AlbumSetPage {
|
||||
}.visibility(this.isEmpty && !this.isTabBarShow ? Visibility.None : Visibility.Visible)
|
||||
|
||||
ToolBar({
|
||||
isShowBar: this.isAlbumSetSelectedMode,
|
||||
isShowBar: this.isAlbumSetSelectedMode && true,
|
||||
toolMenuList: this.barModel.getMenuList(
|
||||
this.isAlbumSetSelectedMode,
|
||||
this.selectedAlbumsCount,
|
||||
|
@ -83,7 +83,7 @@ struct PhotoBrowser {
|
||||
@StorageLink('leftBlank') leftBlank: [number, number, number, number]
|
||||
= [0, ScreenManager.getInstance().getStatusBarHeight(), 0, ScreenManager.getInstance().getNaviBarHeight()];
|
||||
@StorageLink('entryFromHap') entryFromHap: number = Constants.ENTRY_FROM_NONE;
|
||||
transition: string;
|
||||
photoBrowserTransition: string;
|
||||
albumId = '';
|
||||
|
||||
// swiper currentIndex, there may not be onChanged callback during data refresh, so mediaItem cannot be saved
|
||||
@ -547,7 +547,7 @@ struct PhotoBrowser {
|
||||
}
|
||||
|
||||
this.onPhotoChanged(new Number(param.position).valueOf() || 0);
|
||||
this.transition = (this.isFromCamera || this.isFromViewData)
|
||||
this.photoBrowserTransition = (this.isFromCamera || this.isFromViewData)
|
||||
? Constants.PHOTO_TRANSITION_CAMERA : (param.transition ? param.transition.toString() : '');
|
||||
} else {
|
||||
this.logger.info(`photoBrowser start without param`);
|
||||
@ -564,10 +564,10 @@ struct PhotoBrowser {
|
||||
this.jumpSourceToMain = JumpSourceToMain.CAMERA;
|
||||
MediaObserver.getInstance().registerObserver(this.dataObserver);
|
||||
this.onPhotoChanged(AppStorage.Get(Constants.FROM_CURRENT_INDEX) || 0);
|
||||
this.transition = Constants.PHOTO_TRANSITION_CAMERA;
|
||||
this.photoBrowserTransition = Constants.PHOTO_TRANSITION_CAMERA;
|
||||
}
|
||||
|
||||
this.checkedTransition = this.transition
|
||||
this.checkedTransition = this.photoBrowserTransition
|
||||
|
||||
this.onMenuClicked = this.onMenuClicked.bind(this);
|
||||
|
||||
@ -892,7 +892,7 @@ struct PhotoBrowser {
|
||||
PhotoBrowserBg()
|
||||
PhotoSwiper({
|
||||
dataSource: this.dataSource,
|
||||
transition: this.transition,
|
||||
photoSwiperTransition: this.photoBrowserTransition,
|
||||
swiperController: this.controller,
|
||||
onPhotoChanged: this.onPhotoChanged.bind(this)
|
||||
})
|
||||
|
@ -36,7 +36,7 @@ import { AlbumDefine } from '../../../common/model/browser/AlbumDefine'
|
||||
@Entry
|
||||
@Component
|
||||
struct SelectPhotoBrowser {
|
||||
@Provide backgroundColor: Resource = $r('app.color.default_background_color');
|
||||
@Provide selectPhotoBackgroundColor: Resource = $r('app.color.default_background_color');
|
||||
@Provide('selectedCount') totalSelectedCount: number = 0
|
||||
@Provide broadCast: BroadCast = new BroadCast();
|
||||
@Provide isSelected: boolean = true;
|
||||
@ -47,14 +47,14 @@ struct SelectPhotoBrowser {
|
||||
@Provide canSwipe: boolean = true;
|
||||
selectManager: SelectManager;
|
||||
isMultiPick = true;
|
||||
transition: string;
|
||||
selectPhotoTransition: string;
|
||||
controller: SwiperController = new SwiperController();
|
||||
|
||||
// swiper currentIndex, there may not be onChanged callback during data refresh, so mediaItem cannot be saved
|
||||
@Provide('transitionIndex') currentIndex: number = 0;
|
||||
|
||||
// position
|
||||
position: number;
|
||||
selectPhotoPosition: number;
|
||||
timelineIndex: number = -1;
|
||||
|
||||
// logger
|
||||
@ -68,7 +68,7 @@ struct SelectPhotoBrowser {
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.logger.info('photoBrowser aboutToAppear');
|
||||
this.backgroundColor = $r('app.color.black');
|
||||
this.selectPhotoBackgroundColor = $r('app.color.black');
|
||||
ScreenManager.getInstance().setNavigationBarColor('#FFFFFFFF')
|
||||
mMultimodalInputManager.registerListener((control: number) => {
|
||||
this.logger.info(`key control : ${control} index ${this.currentIndex}`);
|
||||
@ -101,7 +101,7 @@ struct SelectPhotoBrowser {
|
||||
}
|
||||
|
||||
this.onPhotoChanged(new Number(param.position).valueOf() || 0);
|
||||
this.transition = param.transition ? param.transition.toString() : '';
|
||||
this.selectPhotoTransition = param.transition ? param.transition.toString() : '';
|
||||
this.onMenuClicked = this.onMenuClicked.bind(this);
|
||||
|
||||
this.dataSource.setBroadCast(this.broadCast);
|
||||
@ -178,12 +178,12 @@ struct SelectPhotoBrowser {
|
||||
onPageShow() {
|
||||
this.logger.info('onPageShow');
|
||||
this.appBroadCast.emit(BroadCastConstants.THIRD_ROUTE_PAGE, []);
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [true, this.transition]);
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [true, this.selectPhotoTransition]);
|
||||
}
|
||||
|
||||
onPageHide() {
|
||||
this.logger.info('onPageHide');
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [false, this.transition]);
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [false, this.selectPhotoTransition]);
|
||||
}
|
||||
|
||||
onMenuClicked(action: Action) {
|
||||
@ -224,7 +224,7 @@ struct SelectPhotoBrowser {
|
||||
PhotoBrowserBg()
|
||||
PhotoSwiper({
|
||||
dataSource: this.dataSource,
|
||||
transition: this.transition,
|
||||
photoSwiperTransition: this.selectPhotoTransition,
|
||||
onPhotoChanged: this.onPhotoChanged.bind(this),
|
||||
swiperController: this.controller
|
||||
})
|
||||
|
@ -686,7 +686,7 @@ export struct PhotoGridPage {
|
||||
isSelected: this.isSelectedMode ?
|
||||
this.mSelectManager.isItemSelected(item.mediaItem.uri) : false,
|
||||
pageName: Constants.PHOTO_TRANSITION_ALBUM,
|
||||
position: item.viewIndex
|
||||
imageGridPosition: item.viewIndex
|
||||
})
|
||||
}
|
||||
.columnStart(item.viewIndex % this.gridRowCount)
|
||||
|
@ -35,7 +35,7 @@ import mMultimodalInputManager from '../../../common/model/common/MultimodalInpu
|
||||
@Entry
|
||||
@Component
|
||||
struct ThirdSelectPhotoBrowser {
|
||||
@Provide backgroundColor: Resource = $r('app.color.default_background_color');
|
||||
@Provide thirdSelectBackgroundColor: Resource = $r('app.color.default_background_color');
|
||||
@Provide('selectedCount') totalSelectedCount: number = 0;
|
||||
@Provide broadCast: BroadCast = new BroadCast();
|
||||
@Provide isSelected: boolean = true;
|
||||
@ -46,13 +46,13 @@ struct ThirdSelectPhotoBrowser {
|
||||
@Provide canSwipe: boolean = true;
|
||||
selectManager: ThirdSelectManager;
|
||||
isMultiPick = true;
|
||||
transition: string;
|
||||
thirdSelectTransition: string;
|
||||
controller: SwiperController = new SwiperController();
|
||||
@Provide('transitionIndex') currentIndex: number = 0;
|
||||
isFromFa: boolean = false;
|
||||
|
||||
// position
|
||||
position: number;
|
||||
thirdSelectPosition: number;
|
||||
|
||||
// logger
|
||||
private logger: Logger = new Logger('PhotoBrowser');
|
||||
@ -63,7 +63,7 @@ struct ThirdSelectPhotoBrowser {
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.logger.info('photoBrowser aboutToAppear');
|
||||
this.backgroundColor = $r('app.color.black');
|
||||
this.thirdSelectBackgroundColor = $r('app.color.black');
|
||||
ScreenManager.getInstance().setNavigationBarColor('#FFFFFFFF')
|
||||
mMultimodalInputManager.registerListener((control: number) => {
|
||||
this.logger.info(`key control : ${control} index ${this.currentIndex}`);
|
||||
@ -89,7 +89,7 @@ struct ThirdSelectPhotoBrowser {
|
||||
|
||||
let param = router.getParams();
|
||||
this.onPhotoChanged(parseInt(param.position.toString()));
|
||||
this.transition = param.transition.toString();
|
||||
this.thirdSelectTransition = param.transition.toString();
|
||||
this.onMenuClicked = this.onMenuClicked.bind(this);
|
||||
|
||||
this.dataSource.setBroadCast(this.broadCast);
|
||||
@ -159,11 +159,11 @@ struct ThirdSelectPhotoBrowser {
|
||||
|
||||
onPageShow() {
|
||||
this.appBroadCast.emit(BroadCastConstants.THIRD_ROUTE_PAGE, []);
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [true, this.transition]);
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [true, this.thirdSelectTransition]);
|
||||
}
|
||||
|
||||
onPageHide() {
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [false, this.transition]);
|
||||
this.appBroadCast.emit(BroadCastConstants.PHOTO_BROWSER_ACTIVE, [false, this.thirdSelectTransition]);
|
||||
}
|
||||
|
||||
onMenuClicked(action: Action) {
|
||||
@ -203,7 +203,7 @@ struct ThirdSelectPhotoBrowser {
|
||||
PhotoBrowserBg()
|
||||
PhotoSwiper({
|
||||
dataSource: this.dataSource,
|
||||
transition: this.transition,
|
||||
photoSwiperTransition: this.thirdSelectTransition,
|
||||
onPhotoChanged: this.onPhotoChanged.bind(this),
|
||||
swiperController: this.controller
|
||||
})
|
||||
|
@ -642,7 +642,7 @@ export struct TimelinePage {
|
||||
GridItem() {
|
||||
TimelineTitleComponent({
|
||||
groupData: item.viewData,
|
||||
position: item.viewIndex,
|
||||
timelinePosition: item.viewIndex,
|
||||
isSelected: this.groupSelectMode[item.viewIndex]
|
||||
})
|
||||
}.columnStart(0).columnEnd(this.gridRowCount - 1)
|
||||
@ -650,7 +650,7 @@ export struct TimelinePage {
|
||||
GridItem() {
|
||||
ImageGridItemComponent({
|
||||
item: item.viewData.mediaItem,
|
||||
position: item.viewIndex,
|
||||
imageGridPosition: item.viewIndex,
|
||||
isSelected: this.isSelectedMode ? this.mSelectManager.isItemSelected(item.viewData.mediaItem.uri, item.viewIndex) : false,
|
||||
pageName: Constants.PHOTO_TRANSITION_TIMELINE
|
||||
})
|
||||
@ -691,7 +691,7 @@ export struct TimelinePage {
|
||||
}
|
||||
|
||||
ToolBar({
|
||||
isShowBar: this.isSelectedMode,
|
||||
isShowBar: this.isSelectedMode && true,
|
||||
toolMenuList: this.barModel.getMenuList(this.isSelectedMode, this.totalSelectedCount, this.isAllSelected),
|
||||
onMenuClicked: this.onMenuClicked
|
||||
})
|
||||
|
@ -27,16 +27,16 @@ export struct TimelineTitleComponent {
|
||||
@Consume isSelectedMode: boolean;
|
||||
@State isSelected: boolean = false;
|
||||
@Consume broadCast: BroadCast;
|
||||
position = 0;
|
||||
timelinePosition = 0;
|
||||
addresses = '';
|
||||
|
||||
aboutToAppear(): void {
|
||||
this.logger.info(`${this.groupData.startDate} position ${this.position}`);
|
||||
this.logger.info(`${this.groupData.startDate} position ${this.timelinePosition}`);
|
||||
}
|
||||
|
||||
selectStateChange() {
|
||||
this.logger.info('change selected.');
|
||||
this.broadCast.emit(BroadCastConstants.GROUP_SELECT, [this.position]);
|
||||
this.broadCast.emit(BroadCastConstants.GROUP_SELECT, [this.timelinePosition]);
|
||||
}
|
||||
|
||||
build() {
|
||||
|
Loading…
Reference in New Issue
Block a user