1/* 2 * Copyright (c) 2022 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 { ItemDataSource } from '../vm/ItemDataSource'; 16import { MediaDataItem } from '../data/MediaDataItem' 17import { Broadcast } from '../utils/Broadcast' 18import { SimpleAlbumDataItem } from '../data/SimpleAlbumDataItem'; 19 20export class MenuContext { 21 items: any[] = []; 22 dataSource: ItemDataSource; 23 24 albumInfo: SimpleAlbumDataItem; 25 26 broadCast: Broadcast; 27 onOperationStart: Function; 28 onOperationEnd: Function; 29 30 jumpSourceToMain: number; 31 deviceId: string; 32 33 albumId: string; 34 deletePageFromType: number; // 0. photoBrowser 1. photoGridPage 35 36 withDeletePageFromType(deletePageFromType: number): MenuContext { 37 this.deletePageFromType = deletePageFromType; 38 return this; 39 } 40 41 withItems(items: MediaDataItem[]): MenuContext { 42 this.items = items; 43 return this; 44 } 45 46 withAlbumId(albumId: string): MenuContext { 47 this.albumId = albumId; 48 return this; 49 } 50 51 withDataSource(dataSource): MenuContext{ 52 this.dataSource = dataSource; 53 return this; 54 } 55 56 withOperationStartCallback(onOperationStart: Function): MenuContext { 57 this.onOperationStart = onOperationStart; 58 return this; 59 } 60 61 withOperationEndCallback(onOperationEnd: Function): MenuContext { 62 this.onOperationEnd = onOperationEnd; 63 return this; 64 } 65 66 withBroadCast(param: Broadcast): MenuContext { 67 this.broadCast = param; 68 return this; 69 } 70 71 withJumpSourceToMain(jumpSourceToMain: number): MenuContext { 72 this.jumpSourceToMain = jumpSourceToMain; 73 return this; 74 } 75 76 withRemoteDevice(deviceId) { 77 this.deviceId = deviceId; 78 return this; 79 } 80 81 withAlbumInfo(albumInfo: SimpleAlbumDataItem) { 82 this.albumInfo = albumInfo; 83 return this; 84 } 85}