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 */ 15import image from '@ohos.multimedia.image'; 16import media from '@ohos.multimedia.media'; 17import { Album, UserFileManagerAccess } from '../../../access/UserFileManagerAccess'; 18 19import type { MediaItem } from '../photo/MediaItem'; 20 21export class AlbumInfo { 22 uri: string; 23 coverUri: string; 24 albumName: string; 25 count: number; 26 isSystemAlbum: boolean; 27 isTrashAlbum: boolean; 28 isFavorAlbum: boolean; 29 isVideoAlbum: boolean; 30 isScreenShotAlbum: boolean; 31 isPhotoAlbum: boolean; 32 filterMediaType: string; 33 dateModified: number; 34 videoCount: number; 35 mediaItem: MediaItem; 36 37 constructor(album: Album) { 38 if (album) { 39 this.uri = album.albumUri; 40 this.coverUri = album.coverUri; 41 this.isSystemAlbum = UserFileManagerAccess.getInstance().isSystemAlbum(album); 42 this.isTrashAlbum = UserFileManagerAccess.getInstance().isTrashAlbum(album); 43 this.isFavorAlbum = UserFileManagerAccess.getInstance().isFavorAlbum(album); 44 this.isVideoAlbum = UserFileManagerAccess.getInstance().isVideoAlbum(album); 45 this.isScreenShotAlbum = UserFileManagerAccess.getInstance().isScreenShotAlbum(album); 46 this.isPhotoAlbum = UserFileManagerAccess.getInstance().isPhotoAlbum(album); 47 this.count = album.count; // TODO 相册count都是0 48 this.dateModified = album.dateModified; 49 } 50 } 51 52 setMediaItem(mediaItem: MediaItem) { 53 this.mediaItem = mediaItem; 54 } 55 56 setAlbumName(albumName: string): void { 57 this.albumName = albumName; 58 } 59 60 setCount(count: number): void { 61 this.count = count; 62 } 63 64 setVideoCount(count: number): void { 65 this.videoCount = count; 66 } 67 68 setFilterMediaType(filterMediaType: string): void { 69 this.filterMediaType = filterMediaType; 70 } 71 72 setCoverUri(coverUri: string): void { 73 this.coverUri = coverUri; 74 } 75 76 getHashCode(): string { 77 return `${this.uri}_${this.coverUri}_${this.count}_${this.albumName}`; 78 } 79} 80