!490 【master】【OpenHarmony 4.0.10.15】【应用子系统】【标准系统】【必现_5/5】大图浏览和宫格界面选择状态不一致

Merge pull request !490 from liujuan/master
This commit is contained in:
openharmony_ci 2023-12-25 02:33:10 +00:00 committed by Gitee
commit 68bc1e3eed
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,7 @@ export class BroadCastConstants {
static readonly UPDATE_PROGRESS: string = 'updateProgress';
static readonly CANCEL_DELETE: string = 'cancelDelete';
static readonly JUMP_THIRD_PHOTO_BROWSER: string = 'jumpThirdPhotoPage';
static readonly UPDATE_SELECT: string = 'updateSelect';
static readonly BACK_PRESS_EVENT: string = 'back';
static readonly RESET_STATE_EVENT: string = 'resetState';
static readonly ON_TAB_CHANGED: string = 'onTabChanged';

View File

@ -80,6 +80,8 @@ export struct ImageGridItemComponent {
private dataSource: MediaDataSource | null = null;
private geometryTapIndex: number = 0;
private isTapStatusChange: boolean = false;
private appBroadCast: BroadCast = BroadCastManager.getInstance().getBroadCast();
private updateSelectFunc: Function = (updateUri: string, select: boolean): void => this.updateSelect(updateUri, select);
verifyTapStatus() {
if (this.placeholderIndex === Constants.INVALID) {
@ -116,9 +118,17 @@ export struct ImageGridItemComponent {
}
Log.info(TAG, `transitionId: ${this.transitionId}`);
this.isTap = this.geometryTransitionString === this.geometryTransitionBrowserId;
this.appBroadCast.on(BroadCastConstants.UPDATE_SELECT, this.updateSelectFunc);
}
updateSelect(updateUri: string, select: boolean): void {
if (updateUri === this.item?.uri) {
this.isSelected = select;
}
}
aboutToDisappear(): void {
this.appBroadCast.off(BroadCastConstants.UPDATE_SELECT, this.updateSelectFunc);
this.resetPressAnim();
}

View File

@ -221,6 +221,7 @@ export struct ThirdSelectPhotoBrowserBase {
}
this.totalSelectedCount = this.selectManager?.getSelectedCount() ?? 0;
this.geometryTransitionId = this.browserController.pageFrom + currentPhoto.getHashCode() + this.isSelected;
this.appBroadCast.emit(BroadCastConstants.UPDATE_SELECT, [currentPhoto.uri, this.isSelected]);
Log.info(TAG, `totalSelectedCount: ${this.totalSelectedCount} after state change geometryTransitionId ${this.geometryTransitionId}`);
}