1/* 2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 photoAccessHelper from '@ohos.file.photoAccessHelper'; 17import { MediaConstants } from '../constants/MediaConstants'; 18import { UserFileDataItem } from '../base/UserFileDataItem'; 19import { screenManager } from '../common/ScreenManager'; 20 21export class InnerUserFileDataItem extends UserFileDataItem { 22 constructor(uri: string, index: number) { 23 super('', [] as string[], '', index); 24 this.mediaType = photoAccessHelper.PhotoType.IMAGE; 25 this.uri = uri; 26 this.size = 256; 27 this.orientation = 0; 28 } 29 30 async load(isForce: boolean): Promise<void> { 31 if (this.status > (isForce ? MediaConstants.PART_LOADED : MediaConstants.UNDEFINED)) { 32 return; 33 } 34 this.width = vp2px(screenManager.getWinWidth()); 35 this.height = vp2px(screenManager.getWinHeight()); 36 if (this.width === 0 || this.height === 0) { 37 this.status = MediaConstants.PART_LOADED; 38 } else { 39 this.status = MediaConstants.LOADED; 40 } 41 } 42 43 async isFavor(): Promise<boolean> { 44 return false; 45 } 46}