1/* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { 17 Action, 18 AlbumInfo, 19 BroadCast, 20 BroadCastConstants, 21 BroadCastManager, 22 BrowserConstants, 23 ColumnSize, 24 Constants, 25 Log, 26 MultimodalInputManager, 27 ScreenManager, 28 UiUtil, 29 UserFileManagerAccess 30} from '@ohos/common'; 31import { EmptyAlbumComponent } from './EmptyAlbumComponent'; 32import router from '@ohos.router'; 33 34const TAG: string = 'browser_AlbumGridItemNewStyle'; 35 36@Extend(Image) function focusSetting(id: string) { 37 .key('AlbumFocus_' + id) 38 .focusable(true) 39} 40 41interface ParamAlbumInfo { 42 item: string; 43 isFromFACard?: boolean; 44} 45 46// The item of album grid, and it's new style. 47@Component 48export struct AlbumGridItemNewStyle { 49 @State @Watch('updateCard') item: AlbumInfo = new AlbumInfo(undefined); 50 @State isEmptyAlbum: boolean = false; 51 @State isSelected: boolean = false; 52 @State selectable: boolean = true; 53 @Provide gridHeight: number = 0; 54 @Provide gridWidth: number = 0; 55 @Link bottomHeight: number; 56 @StorageLink('isSidebar') isSidebar: boolean = ScreenManager.getInstance().isSidebar(); 57 @StorageLink('isHorizontal') isHorizontal: boolean = ScreenManager.getInstance().isHorizontal(); 58 @Consume broadCast: BroadCast; 59 @Consume('selectedCount') selectedCount: number; 60 @Consume @Watch('onModeChange') isAlbumSetSelectedMode: boolean; 61 @Consume rightClickMenuList: Array<Action>; 62 currentRightClickMenuList: Array<Action> = []; 63 onMenuClicked: Function = (): void => {}; 64 onMenuClickedForSingleItem: Function = (): void => {}; 65 gridAspectRatio = Constants.CARD_ASPECT_RATIO; 66 albumCountMarginRight = Constants.ALBUM_SET_NEW_ICON_SIZE + Constants.ALBUM_SET_NEW_ICON_MARGIN * 2; 67 iconMarkAnchorX = Constants.ALBUM_SET_NEW_ICON_SIZE + Constants.ALBUM_SET_NEW_ICON_MARGIN; 68 iconMarkAnchorY = Constants.ALBUM_SET_NEW_ICON_SIZE + Constants.ALBUM_SET_NEW_ICON_MARGIN; 69 @StorageLink('deviceType') deviceType: string | undefined = AppStorage.get<string>('deviceType') ; 70 @State transitionId: string = ''; 71 @StorageLink('isShowPhotoGridView') isShowPhotoGridView: boolean = false; 72 private appBroadCast: BroadCast = BroadCastManager.getInstance().getBroadCast(); 73 private keyIndex?: number; 74 private fp2vpUnit: number = px2vp(fp2px(Constants.NUMBER_1)); 75 private recycleAlbumOfPhoneHeight: number = Constants.RECYCLE_ALBUM_OF_PHONE_HEIGHT; 76 private updateCardSizeFunc: Function = (): void => this.updateCardSize(); 77 78 doAnimation(): void { 79 let albumToPhotoGridDuration: number; 80 let albumToPhotoGridScaleDuration: number; 81 let albumActionBarDuration: number; 82 let photoGridActionBarDuration: number; 83 let photoGridActionBarDelay: number; 84 if (this.deviceType !== Constants.PC_DEVICE_TYPE) { 85 albumToPhotoGridDuration = BrowserConstants.PHONE_LINK_ALBUM_TO_PHOTO_GRID_DURATION; 86 albumToPhotoGridScaleDuration = BrowserConstants.PHONE_LINK_ALBUM_TO_PHOTO_GRID_SCALE_DURATION; 87 albumActionBarDuration = BrowserConstants.PHONE_LINK_ALBUM_ACTIONBAR_DURATION; 88 photoGridActionBarDuration = BrowserConstants.PHONE_LINK_IN_PHOTO_GRID_ACTIONBAR_DURATION; 89 photoGridActionBarDelay = BrowserConstants.PHONE_LINK_PHOTO_GRID_ACTIONBAR_DELAY 90 } else { 91 albumToPhotoGridDuration = BrowserConstants.PC_LINK_ALBUM_TO_PHOTO_GRID_DURATION; 92 albumToPhotoGridScaleDuration = BrowserConstants.PC_LINK_ALBUM_TO_PHOTO_GRID_SCALE_DURATION; 93 albumActionBarDuration = BrowserConstants.PC_LINK_IN_ALBUM_ACTIONBAR_DURATION; 94 photoGridActionBarDuration = BrowserConstants.PC_LINK_IN_PHOTO_GRID_ACTIONBAR_DURATION; 95 photoGridActionBarDelay = BrowserConstants.PC_LINK_PHOTO_GRID_ACTIONBAR_DELAY; 96 } 97 animateTo({ 98 duration: albumToPhotoGridDuration, 99 curve: Curve.Friction, 100 }, () => { 101 AppStorage.SetOrCreate<boolean>(Constants.KEY_OF_IS_SHOW_PHOTO_GRID_VIEW,!this.isShowPhotoGridView); 102 AppStorage.SetOrCreate<number>(Constants.KEY_OF_SELECTED_ALBUM_INDEX, this.keyIndex ? this.keyIndex : -1); 103 AppStorage.SetOrCreate<string>(Constants.KEY_OF_SELECTED_ALBUM_URI, this.item.uri); 104 }) 105 animateTo({ 106 duration: albumActionBarDuration, 107 curve: Curve.Sharp 108 }, () => { 109 if (AppStorage.get<string>('deviceType') !== Constants.PC_DEVICE_TYPE) { 110 AppStorage.SetOrCreate<number>(Constants.KEY_OF_ALBUM_OPACITY, 0); 111 } 112 AppStorage.SetOrCreate<number>(Constants.KEY_OF_ALBUM_ACTIONBAR_OPACITY, 0); 113 }) 114 animateTo({ 115 duration: albumActionBarDuration, 116 curve: Curve.Sharp, 117 delay: BrowserConstants.LINK_IN_PHOTO_GRID_DELAY, 118 }, () => { 119 if (AppStorage.get<string>('deviceType') !== Constants.PC_DEVICE_TYPE) { 120 AppStorage.SetOrCreate<number>(Constants.KEY_OF_PHOTO_GRID_VIEW_OPACITY, 1); 121 } 122 }) 123 animateTo({ 124 duration: albumToPhotoGridScaleDuration, 125 curve: Curve.Friction 126 }, () => { 127 AppStorage.SetOrCreate<number>(Constants.KEY_OF_ALBUM_OTHER_SCALE, BrowserConstants.Album_Scale); 128 }) 129 animateTo({ 130 duration: photoGridActionBarDuration, 131 delay: photoGridActionBarDelay, 132 curve: Curve.Sharp 133 }, () => { 134 AppStorage.SetOrCreate<number>(Constants.KEY_OF_PHOTO_GRID_ACTIONBAR_OPACITY, 1); 135 }) 136 137 if (AppStorage.get<string>('deviceType') !== Constants.PC_DEVICE_TYPE) { 138 animateTo({ 139 duration: BrowserConstants.PC_LINK_IN_PHOTO_GRID_DURATION, 140 delay: BrowserConstants.LINK_IN_PHOTO_GRID_DELAY, 141 curve: Curve.Sharp 142 }, () => { 143 AppStorage.SetOrCreate<number>(Constants.KEY_OF_PHOTO_GRID_VIEW_OPACITY, 1); 144 }) 145 animateTo({ 146 duration: BrowserConstants.PC_LINK_ALBUM_DURATION, 147 curve: Curve.Sharp 148 }, () => { 149 AppStorage.SetOrCreate<number>(Constants.KEY_OF_ALBUM_OPACITY, 0); 150 }) 151 animateTo({ 152 duration: BrowserConstants.PC_LINK_IN_SIDEBAR_DURATION, 153 curve: Curve.Sharp 154 }, () => { 155 AppStorage.SetOrCreate<number>(Constants.KEY_OF_SIDE_BAR_OPACITY, 0); 156 AppStorage.SetOrCreate<number>(Constants.KEY_OF_SIDE_BAR_BOUNDARY_LINE_OPACITY, 0); 157 }) 158 } 159 160 Log.info(TAG, `doanimation`); 161 } 162 163 aboutToAppear(): void { 164 Log.debug(TAG, `aboutToAppear`); 165 this.selectable = !this.item.isTrashAlbum; 166 167 // 后续phone缩略图支持横竖屏后再放开 168 if (AppStorage.get('deviceType') as string !== Constants.DEFAULT_DEVICE_TYPE) { 169 ScreenManager.getInstance().on(ScreenManager.ON_WIN_SIZE_CHANGED, this.updateCardSizeFunc); 170 } 171 let isFirstPhotoItem = AppStorage.get<boolean>(Constants.KEY_OF_IS_FIRST_PHOTO_ITEM); 172 let lastTransitionId = AppStorage.get<string>(Constants.KEY_OF_GEOMETRY_TRANSITION_ID_HEIGHT) as string; 173 if (!isFirstPhotoItem && this.item.uri === AppStorage.get<string>(Constants.KEY_OF_ALBUM_URI)) { 174 this.transitionId = lastTransitionId; 175 } else { 176 if (!this.isRecycleAlbumOfPhoneLikeDevice() && this.item.mediaItem) { 177 let transitionId = `${this.item.mediaItem.getHashCode()}_${this.item.uri}`; 178 Log.info(TAG, `transitionId: ${this.item.mediaItem.getHashCode()}_${this.item.uri}`); 179 if (lastTransitionId === transitionId) { 180 this.transitionId = transitionId; 181 } 182 } 183 } 184 Log.debug(TAG, `aboutToAppear lastTransitionId: ${lastTransitionId}, transitionId: ${this.transitionId}`); 185 this.updateCardSize(); 186 this.initCurrentRightClickMenuList(); 187 } 188 189 aboutToDisappear(): void { 190 // 后续phone缩略图支持横竖屏后再放开 191 if (AppStorage.get('deviceType') as string !== Constants.DEFAULT_DEVICE_TYPE) { 192 ScreenManager.getInstance().off(ScreenManager.ON_WIN_SIZE_CHANGED, this.updateCardSizeFunc); 193 } 194 } 195 196 updateCard() { 197 Log.debug(TAG, 'Album changed and update card size.'); 198 this.updateCardSize(); 199 } 200 201 updateCardSize(): void { 202 let sideBarWidth: number = 0; 203 let count: number = 0; 204 let currentBreakpoint = AppStorage.get<string>('currentBreakpoint'); 205 if (currentBreakpoint === Constants.BREAKPOINT_LG && this.deviceType == Constants.PAD_DEVICE_TYPE) { 206 sideBarWidth = Constants.PAD_TAB_BAR_WIDTH; 207 count = UiUtil.getAlbumGridCount(true); 208 } else { 209 sideBarWidth = this.isSidebar ? Constants.TAB_BAR_WIDTH : 0; 210 count = UiUtil.getAlbumGridCount(this.isSidebar); 211 } 212 let contentWidth = ScreenManager.getInstance().getWinWidth() - sideBarWidth; 213 this.gridWidth = ((contentWidth - Constants.ALBUM_SET_MARGIN * 2 - (Constants.ALBUM_SET_GUTTER * (count - 1))) / count); 214 let numberHeight = Constants.TEXT_SIZE_BODY2 * this.fp2vpUnit; 215 let nameHeight = Constants.TEXT_SIZE_SUB_TITLE1 * this.fp2vpUnit; 216 217 UiUtil.getResourceNumber($r('sys.float.ohos_id_elements_margin_vertical_m')).then((value: number) => { 218 this.bottomHeight = px2vp(value) + nameHeight + Constants.NUMBER_2 + numberHeight; 219 this.gridHeight = this.gridWidth + this.bottomHeight; 220 221 Log.info(TAG, 'updateCardSize gridWidth : ' + this.gridWidth + ', gridHeight : ' + this.gridHeight); 222 223 AppStorage.SetOrCreate(Constants.KEY_OF_ALBUM_HEIGHT, this.gridHeight); 224 AppStorage.SetOrCreate(Constants.KEY_OF_ALBUM_WIDTH, this.gridWidth); 225 }); 226 227 } 228 229 onModeChange(): void { 230 let multiIndex = this.currentRightClickMenuList.indexOf(Action.MULTISELECT); 231 if (this.isAlbumSetSelectedMode) { 232 // 移除多选项 233 this.currentRightClickMenuList.splice(multiIndex, 1); 234 } else { 235 this.isSelected = false; 236 // 添加多选项到第1个位置 237 if (multiIndex < 0) { 238 this.currentRightClickMenuList.splice(0, 0, Action.MULTISELECT); 239 } 240 } 241 } 242 243 selectStateChange() { 244 Log.info(TAG, `change selected.`); 245 if (!this.isAlbumSetSelectedMode) { 246 this.isAlbumSetSelectedMode = true; 247 } 248 if (this.selectable) { 249 let newState: boolean = !this.isSelected; 250 this.broadCast.emit(BroadCastConstants.SELECT, 251 [this.item.uri, newState, this.item.isSystemAlbum, this.item.isSystemAlbum, (): void => { 252 Log.info(TAG, 'enter callback'); 253 this.isSelected = newState; 254 }]); 255 } 256 } 257 258 initCurrentRightClickMenuList() { 259 this.currentRightClickMenuList = new Array<Action>(); 260 if (!this.isAlbumSetSelectedMode) { 261 this.currentRightClickMenuList.push(Action.MULTISELECT); 262 } 263 if (!this.item.isSystemAlbum) { 264 this.currentRightClickMenuList.push(Action.RENAME); 265 this.currentRightClickMenuList.push(Action.DELETE); 266 } 267 } 268 269 @Builder RightClickMenuBuilder() { 270 Column() { 271 ForEach(this.isAlbumSetSelectedMode && this.isSelected ? this.rightClickMenuList : this.currentRightClickMenuList, 272 (menu: Action) => { 273 Text(this.changeTextResToPlural(menu)) 274 .width('100%') 275 .height($r('app.float.menu_height')) 276 .fontColor(menu.fillColor) 277 .fontSize($r('sys.float.ohos_id_text_size_body1')) 278 .fontWeight(FontWeight.Regular) 279 .maxLines(2) 280 .textOverflow({ overflow: TextOverflow.Ellipsis }) 281 .onClick(() => { 282 Log.info(TAG, 'on right click menu, action: ' + menu.actionID); 283 if (menu == Action.MULTISELECT) { 284 this.selectStateChange(); 285 } else { 286 // 1.当鼠标对着被选中的项按右键时,菜单中的功能,针对所有被选中的项做处理 287 // 2.当鼠标对着未被选中的项按右键时,菜单中的功能,仅针对当前项处理,其他被选中的项不做任何处理 288 if (this.isAlbumSetSelectedMode && this.isSelected) { 289 this.onMenuClicked && this.onMenuClicked(menu); 290 } else { 291 this.onMenuClickedForSingleItem && this.onMenuClickedForSingleItem(menu, this.item); 292 } 293 } 294 }) 295 }, (menu: Action) => menu.actionID.toString()) 296 } 297 .width(ScreenManager.getInstance().getColumnsWidth(ColumnSize.COLUMN_ONE_POINT_FIVE)) 298 .borderRadius($r('sys.float.ohos_id_corner_radius_card')) 299 .padding({ 300 top: $r('app.float.menu_padding_vertical'), 301 bottom: $r('app.float.menu_padding_vertical'), 302 left: $r('app.float.menu_padding_horizontal'), 303 right: $r('app.float.menu_padding_horizontal') 304 }) 305 .backgroundColor(Color.White) 306 .margin({ 307 right: $r('sys.float.ohos_id_max_padding_end'), 308 bottom: $r('app.float.menu_margin_bottom') 309 }) 310 } 311 312 isRecycleAlbumOfPhoneLikeDevice(): boolean { 313 return this.deviceType != Constants.PC_DEVICE_TYPE && this.item.isTrashAlbum; 314 } 315 316 @Builder recycleCard() { 317 Flex({ 318 direction: FlexDirection.Row, 319 justifyContent: FlexAlign.Center, 320 alignItems: ItemAlign.Center 321 }) { 322 Image($r('app.media.ic_gallery_public_delete_line')) 323 .width($r('app.float.phone_recycle_ico_size')) 324 .height($r('app.float.phone_recycle_ico_size')) 325 .fillColor($r('sys.color.ohos_id_color_button_normal')) 326 .focusSetting(this.item.uri) 327 } 328 .width(this.gridWidth) 329 .height(this.gridWidth) 330 .backgroundColor($r('sys.color.ohos_id_color_button_normal')) 331 .border({ radius: $r('sys.float.ohos_id_corner_radius_default_m') 332 }) 333 } 334 335 @Builder normalAlbumCard() { 336 Image(this.item.coverUri) 337 .border({ radius: $r('sys.float.ohos_id_corner_radius_default_m') }) 338 .width('100%') 339 .height('100%') 340 .objectFit(ImageFit.Cover) 341 .onError(() => { 342 Log.debug(TAG, 'album is empty or its cover is error'); 343 this.isEmptyAlbum = true; 344 }) 345 .focusSetting(this.item.uri) 346 } 347 348 @Builder albumCardInfo() { 349 Column() { 350 Text(this.getDisplayName(this.item)) 351 .key('AlbumCardDisplayName') 352 .margin({ right: $r('app.float.album_set_name_margin_right') }) 353 .textOverflow({ overflow: TextOverflow.Ellipsis }) 354 .maxLines(1) 355 .fontWeight(FontWeight.Medium) 356 .fontSize($r('sys.float.ohos_id_text_size_body2')) 357 .fontColor($r('sys.color.ohos_id_color_text_primary')) 358 359 Text(String(this.item.count)) 360 .key('AlbumCardItemCount') 361 .margin({ right: this.albumCountMarginRight, top: $r('app.float.photo_grid_gap') }) 362 .textOverflow({ overflow: TextOverflow.Ellipsis }) 363 .maxLines(1) 364 .fontColor($r('sys.color.ohos_id_color_text_secondary')) 365 .fontWeight(FontWeight.Regular) 366 .fontSize($r('sys.float.ohos_id_text_size_body3')) 367 } 368 .width('100%') 369 .margin({ bottom: this.gridWidth - this.gridHeight }) 370 .alignItems(HorizontalAlign.Start) 371 .justifyContent(FlexAlign.End) 372 .padding({ 373 left: $r('sys.float.ohos_id_elements_margin_horizontal_m') 374 }) 375 } 376 377 @Builder selectedModeCheckBox() { 378 Image(this.isSelected ? $r('app.media.ic_checkbox_on') : $r('app.media.ic_checkbox_off_overlay')) 379 .height($r('app.float.album_set_new_style_icon')) 380 .aspectRatio(1) 381 .position({ x: '100%', y: '100%' }) 382 .markAnchor({ x: this.iconMarkAnchorX, y: this.iconMarkAnchorY }) 383 } 384 385 @Builder favorAndVideoAlbumIcoDisplay() { 386 Image(this.item.isFavorAlbum ? $r('app.media.ic_favorite_overlay') : $r('app.media.ic_video')) 387 .height($r('app.float.album_set_new_style_icon')) 388 .aspectRatio(1) 389 .position({ x: '0%', y: '100%' }) 390 .markAnchor({ x: 0 - Constants.ALBUM_SET_NEW_ICON_MARGIN, y: this.iconMarkAnchorY }) 391 } 392 393 @Builder maskLayer() { 394 Image($r('app.media.gradient_mask_layer')) 395 .height('50%') 396 .width('100%') 397 .border({ radius: $r('sys.float.ohos_id_corner_radius_default_m') }) 398 } 399 400 @Builder selectedModeBg() { 401 Column() 402 .height(this.gridWidth) 403 .width(this.gridWidth) 404 .border({ radius: $r('sys.float.ohos_id_corner_radius_default_m') }) 405 .backgroundColor(this.isSelected && this.isAlbumSetSelectedMode && this.selectable 406 ? $r('app.color.item_selection_bg_color') : $r('app.color.transparent')) 407 } 408 409 build() { 410 Column() { 411 Stack({ alignContent: Alignment.Bottom }) { 412 if (this.isEmptyAlbum) { 413 EmptyAlbumComponent() 414 } 415 416 if (this.item.isTrashAlbum) { 417 this.recycleCard() 418 } else { 419 this.normalAlbumCard() 420 } 421 422 if (!this.isSelected && (this.item.isFavorAlbum || this.item.isVideoAlbum || (this.isAlbumSetSelectedMode && this.selectable))) { 423 this.maskLayer() 424 } 425 426 this.albumCardInfo() 427 428 if (this.item.isFavorAlbum || this.item.isVideoAlbum) { 429 this.favorAndVideoAlbumIcoDisplay() 430 } 431 432 this.selectedModeBg() 433 434 if (this.isAlbumSetSelectedMode && this.selectable) { 435 this.selectedModeCheckBox() 436 } 437 } 438 } 439 .width(this.gridWidth) 440 .height(this.gridWidth) 441 .borderRadius($r('sys.float.ohos_id_corner_radius_default_m')) 442 .geometryTransition(this.transitionId) 443 .gesture( 444 LongPressGesture() 445 .onAction(() => { 446 this.selectStateChange(); 447 }) 448 ) 449 .onClick(() => { 450 if (!this.isRecycleAlbumOfPhoneLikeDevice() && this.item.mediaItem) { 451 this.transitionId = `${this.item.mediaItem?.getHashCode()}_${this.item.uri}`; 452 } 453 this.albumOnClick(); 454 }) 455 .bindContextMenu(this.RightClickMenuBuilder, this.showRightClickPopup() ? ResponseType.RightClick : -1) 456 .onKeyEvent((event?: KeyEvent) => { 457 if (event != null && KeyType.Up == event.type) { 458 switch (event.keyCode) { 459 case MultimodalInputManager.KEY_CODE_KEYBOARD_ENTER: 460 this.albumOnClick(); 461 break; 462 default: 463 break; 464 } 465 } 466 }) 467 } 468 469 private changeTextResToPlural(action: Action): Resource { 470 let textStr: Resource = action.textRes; 471 if (Action.RECOVER.equals(action)) { 472 textStr = this.isSelected 473 ? $r('app.plural.action_recover_count', this.selectedCount, this.selectedCount) 474 : $r('app.string.action_recover'); 475 } else if (Action.DELETE.equals(action)) { 476 textStr = this.isSelected 477 ? $r('app.plural.action_delete_count', this.selectedCount, this.selectedCount) 478 : $r('app.string.action_delete'); 479 } else if (Action.MOVE.equals(action)) { 480 textStr = this.isSelected 481 ? $r('app.plural.move_to_album_count', this.selectedCount, this.selectedCount) 482 : $r('app.string.move_to_album'); 483 } else if (Action.ADD.equals(action)) { 484 textStr = this.isSelected 485 ? $r('app.plural.add_to_album_count', this.selectedCount, this.selectedCount) 486 : $r('app.string.add_to_album'); 487 } 488 return textStr; 489 } 490 491 private albumOnClick() { 492 if (this.isAlbumSetSelectedMode) { 493 this.selectStateChange(); 494 } else { 495 Log.info(TAG, `After onClick, MediaSet is: ${JSON.stringify(this.item)}`); 496 if (this.item.isTrashAlbum && (AppStorage.get<string>('deviceType') !== Constants.PC_DEVICE_TYPE)) { 497 router.pushUrl({ 498 url: 'pages/PhotoGridPage', 499 params: { 500 item: JSON.stringify(this.item) 501 } 502 }); 503 } else if (!this.isShowPhotoGridView) { 504 let albumInfo: ParamAlbumInfo = { item: JSON.stringify(this.item) } 505 AppStorage.setOrCreate<ParamAlbumInfo>(Constants.KEY_OF_PHOTO_GRID_VIEW_ALBUM_ITEM, albumInfo); 506 AppStorage.SetOrCreate(Constants.KEY_OF_GEOMETRY_TRANSITION_ID_HEIGHT, this.transitionId); 507 AppStorage.SetOrCreate(Constants.KEY_OF_ALBUM_URI, this.item.uri); 508 this.doAnimation(); 509 } else { 510 Log.info(TAG, `PhotoGridView is show, has no focus, Users need to manually activate the focus.`); 511 } 512 } 513 } 514 515 private showRightClickPopup(): boolean { 516 if (this.isAlbumSetSelectedMode && this.isSelected) { 517 Log.debug(TAG, `Album ${this.item?.albumName} length1: ${this.rightClickMenuList.length}`); 518 return this.rightClickMenuList.length > 0 519 } else { 520 Log.debug(TAG, `Album ${this.item?.albumName} length2: ${this.currentRightClickMenuList.length}`); 521 return this.currentRightClickMenuList.length > 0 522 } 523 } 524 525 private getDisplayName(albumInfo : AlbumInfo): Resource | string { 526 let res = UiUtil.getDisplayNameResourceByAlbumInfo(albumInfo); 527 if (res != null) { 528 return res; 529 } 530 return this.item.albumName; 531 } 532}