• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
15
16import { MediaItem } from '../../model/browser/photo/MediaItem';
17import { SelectManager } from '../../model/browser/SelectManager';
18import { BroadCast } from '../../utils/BroadCast';
19import { AlbumSetDataSource } from '../../model/browser/album/AlbumSetDataSource';
20import { AlbumInfo } from '../../model/browser/album/AlbumInfo';
21
22export class MenuContext {
23  mediaItem: MediaItem;
24  albumUri: string;
25  selectManager: SelectManager;
26  onOperationStart: Function;
27  onOperationCancel: Function;
28  onOperationEnd: Function;
29  broadCast: BroadCast
30  latlng: number[];
31  jumpSourceToMain: number;
32  albumSetDataSource: AlbumSetDataSource;
33  deviceId: string;
34  albumInfo: AlbumInfo;
35  fromSelectMode: boolean;
36  targetAlbumName: string;
37
38  withMediaItem(mediaItem: MediaItem): MenuContext {
39    this.mediaItem = mediaItem;
40    return this;
41  }
42
43  withAlbumUri(albumUri: string): MenuContext {
44    this.albumUri = albumUri;
45    return this;
46  }
47
48  withSelectManager(selectManager: SelectManager): MenuContext {
49    this.selectManager = selectManager;
50    return this;
51  }
52
53  withOperationStartCallback(onOperationStart: Function): MenuContext {
54    this.onOperationStart = onOperationStart;
55    return this;
56  }
57
58  withOperationCancelCallback(onOperationCancel: Function): MenuContext {
59    this.onOperationCancel = onOperationCancel;
60    return this;
61  }
62
63  withOperationEndCallback(onOperationEnd: Function): MenuContext {
64    this.onOperationEnd = onOperationEnd;
65    return this;
66  }
67
68  withBroadCast(param: BroadCast): MenuContext {
69    this.broadCast = param;
70    return this;
71  }
72
73  withLatlng(latlng: number[]): MenuContext {
74    this.latlng = latlng;
75    return this;
76  }
77
78  withJumpSourceToMain(jumpSourceToMain: number): MenuContext {
79    this.jumpSourceToMain = jumpSourceToMain;
80    return this;
81  }
82
83  withAlbumSetDataSource(albumSetDataSource: AlbumSetDataSource): MenuContext {
84    this.albumSetDataSource = albumSetDataSource;
85    return this;
86  }
87
88  withRemoteDevice(deviceId) {
89    this.deviceId = deviceId;
90    return this;
91  }
92
93  withAlbumInfo(albumInfo) {
94    this.albumInfo = albumInfo;
95    return this;
96  }
97
98  withTargetAlbumName(albumName) {
99    this.targetAlbumName = albumName;
100    return this;
101  }
102
103  withFromSelectMode(fromSelectMode) {
104    this.fromSelectMode = fromSelectMode;
105    return this;
106  }
107}